mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 18:27:05 +00:00
47 lines
907 B
TypeScript
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[];
|
|
}
|