add api tables with permission
This commit is contained in:
parent
0bbe22e9ae
commit
26d2f288e9
4 changed files with 97 additions and 0 deletions
19
src/entity/user/api.ts
Normal file
19
src/entity/user/api.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { Column, CreateDateColumn, Entity, PrimaryColumn } from "typeorm";
|
||||
|
||||
@Entity()
|
||||
export class api {
|
||||
@PrimaryColumn({ type: "varchar", length: 255 })
|
||||
token: string;
|
||||
|
||||
@Column({ type: "varchar", length: 255 })
|
||||
title: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@Column({ type: "datetime", nullable: true })
|
||||
lastUsage?: Date;
|
||||
|
||||
@Column({ type: "datetime", nullable: true })
|
||||
expiry?: Date;
|
||||
}
|
19
src/entity/user/api_permission.ts
Normal file
19
src/entity/user/api_permission.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { PermissionObject, PermissionString } from "../../type/permissionTypes";
|
||||
import { api } from "./api";
|
||||
|
||||
@Entity()
|
||||
export class apiPermission {
|
||||
@PrimaryColumn({ type: "int" })
|
||||
apiToken: number;
|
||||
|
||||
@PrimaryColumn({ type: "varchar", length: 255 })
|
||||
permission: PermissionString;
|
||||
|
||||
@ManyToOne(() => api, {
|
||||
nullable: false,
|
||||
onDelete: "CASCADE",
|
||||
onUpdate: "RESTRICT",
|
||||
})
|
||||
api: api;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue