37 lines
734 B
TypeScript
37 lines
734 B
TypeScript
import { Entity, Column, ManyToMany, OneToMany } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { ApiName } from "./ApiName";
|
|
import { ApiHistory } from "./ApiHistory";
|
|
|
|
@Entity("apiKey")
|
|
export class ApiKey extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ชื่อ",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
name: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "keyApi",
|
|
length: 255,
|
|
default: null,
|
|
})
|
|
keyApi: string;
|
|
|
|
@ManyToMany(() => ApiName, (apiName) => apiName.apiKeys)
|
|
apiNames: ApiName[];
|
|
|
|
@OneToMany(() => ApiHistory, (v) => v.apiKey)
|
|
apiHistorys: ApiHistory[];
|
|
}
|
|
|
|
export class CreateApiKey {
|
|
@Column()
|
|
name: string;
|
|
|
|
@Column()
|
|
apiId: string[];
|
|
}
|