no message
This commit is contained in:
parent
1155be4116
commit
9ec42fd5d9
6 changed files with 311 additions and 0 deletions
66
src/entities/ApiHistory.ts
Normal file
66
src/entities/ApiHistory.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ApiKey } from "./ApiKey";
|
||||
|
||||
@Entity("apiHistory")
|
||||
export class ApiHistory extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "header",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
headerApi: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "token",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
tokenApi: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "request",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
requestApi: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "response",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
responseApi: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ip",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
ipApi: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "code",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
codeApi: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ApiKey",
|
||||
default: null,
|
||||
})
|
||||
apiKeyId: string;
|
||||
|
||||
@ManyToOne(() => ApiKey, (apiKey) => apiKey.apiHistorys)
|
||||
@JoinColumn({ name: "apiKeyId" })
|
||||
apiKey: ApiKey;
|
||||
}
|
||||
37
src/entities/ApiKey.ts
Normal file
37
src/entities/ApiKey.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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[];
|
||||
}
|
||||
34
src/entities/ApiName.ts
Normal file
34
src/entities/ApiName.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { Entity, Column, ManyToMany, JoinTable } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { ApiKey } from "./ApiKey";
|
||||
|
||||
@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[];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue