diff --git a/apps/api/src/modules/auth/entities/access-token.entity.ts b/apps/api/src/modules/auth/entities/access-token.entity.ts index 53fb68a..aa1513a 100644 --- a/apps/api/src/modules/auth/entities/access-token.entity.ts +++ b/apps/api/src/modules/auth/entities/access-token.entity.ts @@ -6,6 +6,7 @@ import { ManyToOne, OneToOne, PrimaryGeneratedColumn, + Relation, } from 'typeorm' import { RefreshTokenEntity } from './refresh-token.entity' @@ -47,7 +48,7 @@ export class AccessTokenEntity extends BaseEntity { cascade: true, }, ) - refreshToken!: RefreshTokenEntity + refreshToken!: Relation /** * @description 所属用户 @@ -56,5 +57,5 @@ export class AccessTokenEntity extends BaseEntity { @ManyToOne(() => UserEntity, user => user.accessTokens, { onDelete: 'CASCADE', }) - user!: UserEntity + user!: Relation } diff --git a/apps/api/src/modules/auth/entities/refresh-token.entity.ts b/apps/api/src/modules/auth/entities/refresh-token.entity.ts index 9794ca2..b88b756 100644 --- a/apps/api/src/modules/auth/entities/refresh-token.entity.ts +++ b/apps/api/src/modules/auth/entities/refresh-token.entity.ts @@ -6,6 +6,7 @@ import { JoinColumn, OneToOne, PrimaryGeneratedColumn, + Relation, } from 'typeorm' import { AccessTokenEntity } from './access-token.entity' @@ -47,5 +48,5 @@ export class RefreshTokenEntity extends BaseEntity { }, ) @JoinColumn() - accessToken!: AccessTokenEntity + accessToken!: Relation } diff --git a/apps/api/src/modules/system/dept/dept.entity.ts b/apps/api/src/modules/system/dept/dept.entity.ts index a21018c..098583f 100644 --- a/apps/api/src/modules/system/dept/dept.entity.ts +++ b/apps/api/src/modules/system/dept/dept.entity.ts @@ -3,6 +3,7 @@ import { Column, Entity, OneToMany, + Relation, Tree, TreeChildren, TreeParent, @@ -26,8 +27,8 @@ export class DeptEntity extends AbstractEntity { children!: DeptEntity[] @TreeParent({ onDelete: 'SET NULL' }) - parent?: DeptEntity | null + parent?: DeptEntity @OneToMany(() => UserEntity, user => user.dept) - users: UserEntity[] + users: Relation } diff --git a/apps/api/src/modules/system/log/entities/login-log.entity.ts b/apps/api/src/modules/system/log/entities/login-log.entity.ts index 0b06631..971a23b 100644 --- a/apps/api/src/modules/system/log/entities/login-log.entity.ts +++ b/apps/api/src/modules/system/log/entities/login-log.entity.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger' -import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm' +import { Column, Entity, JoinColumn, ManyToOne, Relation } from 'typeorm' import { UserEntity } from '../../../user/entities/user.entity' import { AbstractEntity } from '@/common/entity/abstract.entity' @@ -28,5 +28,5 @@ export class LoginLogEntity extends AbstractEntity { @ManyToOne(() => UserEntity) @JoinColumn() - user: UserEntity + user: Relation } diff --git a/apps/api/src/modules/system/log/entities/task-log.entity.ts b/apps/api/src/modules/system/log/entities/task-log.entity.ts index a9c1c95..5e7b06b 100644 --- a/apps/api/src/modules/system/log/entities/task-log.entity.ts +++ b/apps/api/src/modules/system/log/entities/task-log.entity.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger' -import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm' +import { Column, Entity, JoinColumn, ManyToOne, Relation } from 'typeorm' import { TaskEntity } from '../../task/task.entity' import { AbstractEntity } from '@/common/entity/abstract.entity' @@ -20,5 +20,5 @@ export class TaskLogEntity extends AbstractEntity { @ManyToOne(() => TaskEntity) @JoinColumn() - task: TaskEntity + task: Relation } diff --git a/apps/api/src/modules/system/menu/menu.entity.ts b/apps/api/src/modules/system/menu/menu.entity.ts index ec307f7..18d6e7d 100644 --- a/apps/api/src/modules/system/menu/menu.entity.ts +++ b/apps/api/src/modules/system/menu/menu.entity.ts @@ -1,4 +1,4 @@ -import { Column, Entity, ManyToMany } from 'typeorm' +import { Column, Entity, ManyToMany, Relation } from 'typeorm' import { RoleEntity } from '../role/role.entity' import { AbstractEntity } from '@/common/entity/abstract.entity' @@ -42,5 +42,5 @@ export class MenuEntity extends AbstractEntity { status: number @ManyToMany(() => RoleEntity, role => role.menus) - roles: RoleEntity[] + roles: Relation } diff --git a/apps/api/src/modules/system/role/role.entity.ts b/apps/api/src/modules/system/role/role.entity.ts index 86a6ea0..9ec2b35 100644 --- a/apps/api/src/modules/system/role/role.entity.ts +++ b/apps/api/src/modules/system/role/role.entity.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger' -import { Column, Entity, JoinTable, ManyToMany } from 'typeorm' +import { Column, Entity, JoinTable, ManyToMany, Relation } from 'typeorm' import { UserEntity } from '../../user/entities/user.entity' import { MenuEntity } from '../menu/menu.entity' @@ -24,9 +24,9 @@ export class RoleEntity extends AbstractEntity { status: number @ManyToMany(() => UserEntity, user => user.roles) - users: UserEntity[] + users: Relation @ManyToMany(() => MenuEntity, menu => menu.roles, {}) @JoinTable() - menus: MenuEntity[] + menus: Relation } diff --git a/apps/api/src/modules/todo/todo.entity.ts b/apps/api/src/modules/todo/todo.entity.ts index 37e6287..1598b6a 100644 --- a/apps/api/src/modules/todo/todo.entity.ts +++ b/apps/api/src/modules/todo/todo.entity.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger' -import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm' +import { Column, Entity, JoinColumn, ManyToOne, Relation } from 'typeorm' import { AbstractEntity } from '@/common/entity/abstract.entity' import { UserEntity } from '@/modules/user/entities/user.entity' @@ -16,5 +16,5 @@ export class TodoEntity extends AbstractEntity { @ManyToOne(() => UserEntity) @JoinColumn() - user: UserEntity + user: Relation } diff --git a/apps/api/src/modules/user/entities/user.entity.ts b/apps/api/src/modules/user/entities/user.entity.ts index 3947265..ff46612 100644 --- a/apps/api/src/modules/user/entities/user.entity.ts +++ b/apps/api/src/modules/user/entities/user.entity.ts @@ -7,6 +7,7 @@ import { ManyToMany, ManyToOne, OneToMany, + Relation, } from 'typeorm' import { AbstractEntity } from '@/common/entity/abstract.entity' @@ -51,14 +52,14 @@ export class UserEntity extends AbstractEntity { @ManyToMany(() => RoleEntity, role => role.users) @JoinTable() - roles: RoleEntity[] + roles: Relation @ManyToOne(() => DeptEntity, dept => dept.users) @JoinColumn() - dept: DeptEntity + dept: Relation @OneToMany(() => AccessTokenEntity, accessToken => accessToken.user, { cascade: true, }) - accessTokens: AccessTokenEntity[] + accessTokens: Relation }