hrms-api-org/src/entities/ApiName.ts
2024-12-04 21:18:10 +07:00

38 lines
783 B
TypeScript

import { Entity, Column, ManyToMany, JoinTable, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { ApiKey } from "./ApiKey";
import { ApiHistory } from "./ApiHistory";
@Entity("apiName")
export class ApiName extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อ",
length: 255,
default: null,
})
name: string;
@Column({
nullable: true,
comment: "path",
length: 255,
default: null,
})
pathApi: string;
@Column({
nullable: true,
comment: "method",
length: 255,
default: null,
})
methodApi: string;
@ManyToMany(() => ApiKey, (apiKey) => apiKey.apiNames)
@JoinTable()
apiKeys: ApiKey[];
@OneToMany(() => ApiHistory, (v) => v.apiName)
apiHistorys: ApiHistory[];
}