Files
backend/libs/common/src/modules/client/entities/client.entity.ts
2025-03-27 01:55:26 +03:00

47 lines
907 B
TypeScript

import { Entity, Column, Unique, OneToMany } from 'typeorm';
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
import { ClientDto } from '../dtos';
import { UserEntity } from '../../user/entities';
@Entity({ name: 'clients' })
@Unique(['clientId'])
export class ClientEntity extends AbstractEntity<ClientDto> {
@Column({
type: 'uuid',
default: () => 'gen_random_uuid()',
nullable: false,
})
public uuid: string;
@Column({
length: 255,
nullable: false,
})
name: string;
@Column({
length: 255,
nullable: false,
unique: true,
})
clientId: string;
@Column({
length: 255,
nullable: false,
})
clientSecret: string;
@Column({
length: 255,
nullable: false,
})
redirectUri: string;
@Column('simple-array')
scopes: string[];
@OneToMany(() => UserEntity, (user) => user.client)
users: UserEntity[];
}