api apikeyhistory
This commit is contained in:
parent
f7653aa4cf
commit
62f803f3e3
5 changed files with 87 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ApiKey } from "./ApiKey";
|
||||
import { ApiName } from "./ApiName";
|
||||
|
||||
@Entity("apiHistory")
|
||||
export class ApiHistory extends EntityBase {
|
||||
|
|
@ -63,4 +64,16 @@ export class ApiHistory extends EntityBase {
|
|||
@ManyToOne(() => ApiKey, (apiKey) => apiKey.apiHistorys)
|
||||
@JoinColumn({ name: "apiKeyId" })
|
||||
apiKey: ApiKey;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ApiName",
|
||||
default: null,
|
||||
})
|
||||
apiNameId: string;
|
||||
|
||||
@ManyToOne(() => ApiName, (apiName) => apiName.apiHistorys)
|
||||
@JoinColumn({ name: "apiNameId" })
|
||||
apiName: ApiName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Entity, Column, ManyToMany, JoinTable } from "typeorm";
|
||||
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 {
|
||||
|
|
@ -31,4 +32,7 @@ export class ApiName extends EntityBase {
|
|||
@ManyToMany(() => ApiKey, (apiKey) => apiKey.apiNames)
|
||||
@JoinTable()
|
||||
apiKeys: ApiKey[];
|
||||
|
||||
@OneToMany(() => ApiHistory, (v) => v.apiName)
|
||||
apiHistorys: ApiHistory[];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue