hrms-api-org/src/entities/ApiKey.ts

104 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-11-27 13:53:49 +07:00
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({
2025-11-03 15:57:41 +07:00
type: 'longtext',
2024-11-27 13:53:49 +07:00
nullable: true,
comment: "keyApi",
default: null,
})
keyApi: string;
2025-10-25 01:55:54 +07:00
@Column({
nullable: true,
comment: "accessType",
length: 40,
default: null,
})
accessType: string;
@Column({
nullable: true,
comment: "dnaRootId",
length: 40,
default: null,
})
dnaRootId: string;
@Column({
nullable: true,
comment: "dnaChild1Id",
length: 40,
default: null,
})
dnaChild1Id: string;
@Column({
nullable: true,
comment: "dnaChild2Id",
length: 40,
default: null,
})
dnaChild2Id: string;
@Column({
nullable: true,
comment: "dnaChild3Id",
length: 40,
default: null,
})
dnaChild3Id: string;
@Column({
nullable: true,
comment: "dnaChild4Id",
length: 40,
default: null,
})
dnaChild4Id: string;
2024-11-27 13:53:49 +07:00
@ManyToMany(() => ApiName, (apiName) => apiName.apiKeys)
apiNames: ApiName[];
@OneToMany(() => ApiHistory, (v) => v.apiKey)
apiHistorys: ApiHistory[];
}
export class CreateApiKey {
@Column()
name: string;
@Column()
apiId: string[];
2025-10-25 01:55:54 +07:00
@Column()
accessType?: string;
@Column()
dnaRootId?: string;
@Column()
dnaChild1Id?: string;
@Column()
dnaChild2Id?: string;
@Column()
dnaChild3Id?: string;
@Column()
dnaChild4Id?: string;
2024-11-27 13:53:49 +07:00
}