convert project from microservices to rest apis

This commit is contained in:
faris Aljohari
2024-03-10 12:49:51 +03:00
parent b3179a5c1f
commit c5537b3230
72 changed files with 155 additions and 384 deletions

View File

@ -1 +1 @@
export * from './abstract.dto'
export * from './abstract.dto';

View File

@ -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`,
);
}

View File

@ -22,5 +22,4 @@ export class SessionDto {
@IsBoolean()
@IsNotEmpty()
public isLoggedOut: boolean;
}

View File

@ -1 +1 @@
export * from './session.entity'
export * from './session.entity';

View File

@ -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,
})

View File

@ -1 +1 @@
export * from './user-otp.dto'
export * from './user-otp.dto';

View File

@ -4,7 +4,7 @@ export class UserOtpDto {
@IsString()
@IsNotEmpty()
public uuid: string;
@IsString()
@IsNotEmpty()
public email: string;

View File

@ -1 +1 @@
export * from './user-otp.entity'
export * from './user-otp.entity';

View File

@ -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;

View File

@ -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,
})