加入权限模块、用户模块加入userRole实体
This commit is contained in:
23
tone-page-server/src/user/entities/user-role.entity.ts
Normal file
23
tone-page-server/src/user/entities/user-role.entity.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'roleId'])
|
||||
export class UserRole {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column('uuid')
|
||||
roleId: string;
|
||||
|
||||
@Column('uuid')
|
||||
userId: string
|
||||
|
||||
@Column()
|
||||
isEnabled: boolean;
|
||||
|
||||
@CreateDateColumn({ precision: 3 })
|
||||
createdAt: Date;
|
||||
|
||||
@Column({ nullable: true, precision: 3 })
|
||||
expiredAt?: Date;
|
||||
}
|
||||
@@ -6,10 +6,11 @@ import { UserService } from './user.service';
|
||||
import { UserSession } from './entities/user-session.entity';
|
||||
import { AuthModule } from 'src/auth/auth.module';
|
||||
import { UserSessionService } from './services/user-session.service';
|
||||
import { UserRole } from './entities/user-role.entity';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([User, UserSession]),
|
||||
TypeOrmModule.forFeature([User, UserSession, UserRole]),
|
||||
forwardRef(() => AuthModule),// 解决循环依赖问题
|
||||
],
|
||||
controllers: [UserController],
|
||||
|
||||
Reference in New Issue
Block a user