mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
convert project from microservices to rest apis
This commit is contained in:
@ -1 +1 @@
|
||||
export * from './abstract.dto'
|
||||
export * from './abstract.dto';
|
||||
|
@ -8,11 +8,11 @@ import {
|
||||
} from 'typeorm';
|
||||
|
||||
import { AbstractDto } from '../dtos';
|
||||
import { Constructor } from '@app/common/util/types';
|
||||
import { Constructor } from '../../../../../common/src/util/types';
|
||||
|
||||
export abstract class AbstractEntity<
|
||||
T extends AbstractDto = AbstractDto,
|
||||
O = never
|
||||
O = never,
|
||||
> {
|
||||
@PrimaryGeneratedColumn('increment')
|
||||
@Exclude()
|
||||
@ -38,7 +38,7 @@ export abstract class AbstractEntity<
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!dtoClass) {
|
||||
throw new Error(
|
||||
`You need to use @UseDto on class (${this.constructor.name}) be able to call toDto function`
|
||||
`You need to use @UseDto on class (${this.constructor.name}) be able to call toDto function`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,5 +22,4 @@ export class SessionDto {
|
||||
@IsBoolean()
|
||||
@IsNotEmpty()
|
||||
public isLoggedOut: boolean;
|
||||
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export * from './session.entity'
|
||||
export * from './session.entity';
|
||||
|
@ -5,7 +5,7 @@ import { SessionDto } from '../dtos/session.dto';
|
||||
@Entity({ name: 'userSession' })
|
||||
export class UserSessionEntity extends AbstractEntity<SessionDto> {
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
type: 'uuid',
|
||||
default: () => 'gen_random_uuid()',
|
||||
nullable: false,
|
||||
})
|
||||
|
@ -1 +1 @@
|
||||
export * from './user-otp.dto'
|
||||
export * from './user-otp.dto';
|
||||
|
@ -4,7 +4,7 @@ export class UserOtpDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
public uuid: string;
|
||||
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
public email: string;
|
||||
|
@ -1 +1 @@
|
||||
export * from './user-otp.entity'
|
||||
export * from './user-otp.entity';
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { Column, Entity } from 'typeorm';
|
||||
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||
import { UserOtpDto } from '../dtos';
|
||||
import { OtpType } from '@app/common/constants/otp-type.enum';
|
||||
import { OtpType } from '../../../../src/constants/otp-type.enum';
|
||||
|
||||
@Entity({ name: 'user-otp' })
|
||||
export class UserOtpEntity extends AbstractEntity<UserOtpDto> {
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
default: () => 'gen_random_uuid()',
|
||||
type: 'uuid',
|
||||
default: () => 'gen_random_uuid()',
|
||||
nullable: false,
|
||||
})
|
||||
public uuid: string;
|
||||
|
@ -5,7 +5,7 @@ import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||
@Entity({ name: 'user' })
|
||||
export class UserEntity extends AbstractEntity<UserDto> {
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
type: 'uuid',
|
||||
default: () => 'gen_random_uuid()', // Use gen_random_uuid() for default value
|
||||
nullable: false,
|
||||
})
|
||||
|
Reference in New Issue
Block a user