mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 21:59:40 +00:00
refactor: sepeare user and auth modules
This commit is contained in:
@ -27,6 +27,7 @@ import { JuniorModule } from './junior/junior.module';
|
|||||||
import { MoneyRequestModule } from './money-request/money-request.module';
|
import { MoneyRequestModule } from './money-request/money-request.module';
|
||||||
import { SavingGoalsModule } from './saving-goals/saving-goals.module';
|
import { SavingGoalsModule } from './saving-goals/saving-goals.module';
|
||||||
import { TaskModule } from './task/task.module';
|
import { TaskModule } from './task/task.module';
|
||||||
|
import { UserModule } from './user/user.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [],
|
controllers: [],
|
||||||
@ -72,6 +73,8 @@ import { TaskModule } from './task/task.module';
|
|||||||
LookupModule,
|
LookupModule,
|
||||||
|
|
||||||
HealthModule,
|
HealthModule,
|
||||||
|
|
||||||
|
UserModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
// Global Pipes
|
// Global Pipes
|
||||||
|
@ -1,24 +1,15 @@
|
|||||||
import { forwardRef, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { JwtModule } from '@nestjs/jwt';
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
||||||
import { CustomerModule } from '~/customer/customer.module';
|
|
||||||
import { JuniorModule } from '~/junior/junior.module';
|
import { JuniorModule } from '~/junior/junior.module';
|
||||||
|
import { UserModule } from '~/user/user.module';
|
||||||
import { AuthController } from './controllers';
|
import { AuthController } from './controllers';
|
||||||
import { Device, User } from './entities';
|
import { AuthService } from './services';
|
||||||
import { DeviceRepository, UserRepository } from './repositories';
|
|
||||||
import { AuthService, DeviceService } from './services';
|
|
||||||
import { UserService } from './services/user.service';
|
|
||||||
import { AccessTokenStrategy } from './strategies';
|
import { AccessTokenStrategy } from './strategies';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [JwtModule.register({}), JuniorModule, UserModule],
|
||||||
TypeOrmModule.forFeature([User, Device]),
|
providers: [AuthService, AccessTokenStrategy],
|
||||||
JwtModule.register({}),
|
|
||||||
forwardRef(() => CustomerModule),
|
|
||||||
forwardRef(() => JuniorModule),
|
|
||||||
],
|
|
||||||
providers: [AuthService, UserRepository, UserService, DeviceService, DeviceRepository, AccessTokenStrategy],
|
|
||||||
controllers: [AuthController],
|
controllers: [AuthController],
|
||||||
exports: [DeviceService, UserService],
|
exports: [],
|
||||||
})
|
})
|
||||||
export class AuthModule {}
|
export class AuthModule {}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { User } from '~/auth/entities';
|
|
||||||
import { ILoginResponse } from '~/auth/interfaces';
|
import { ILoginResponse } from '~/auth/interfaces';
|
||||||
import { CustomerResponseDto } from '~/customer/dtos/response';
|
import { CustomerResponseDto } from '~/customer/dtos/response';
|
||||||
|
import { User } from '~/user/entities';
|
||||||
import { UserResponseDto } from './user.response.dto';
|
import { UserResponseDto } from './user.response.dto';
|
||||||
|
|
||||||
export class LoginResponseDto {
|
export class LoginResponseDto {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { User } from '~/auth/entities';
|
|
||||||
import { Roles } from '~/auth/enums';
|
import { Roles } from '~/auth/enums';
|
||||||
|
import { User } from '~/user/entities';
|
||||||
|
|
||||||
export class UserResponseDto {
|
export class UserResponseDto {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { User } from '~/auth/entities';
|
|
||||||
import { ILoginResponse } from '~/auth/interfaces';
|
import { ILoginResponse } from '~/auth/interfaces';
|
||||||
|
import { User } from '~/user/entities';
|
||||||
|
|
||||||
export class VerifyUserResponseDto {
|
export class VerifyUserResponseDto {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
|
@ -7,6 +7,9 @@ import { CacheService } from '~/common/modules/cache/services';
|
|||||||
import { OtpScope, OtpType } from '~/common/modules/otp/enums';
|
import { OtpScope, OtpType } from '~/common/modules/otp/enums';
|
||||||
import { OtpService } from '~/common/modules/otp/services';
|
import { OtpService } from '~/common/modules/otp/services';
|
||||||
import { JuniorTokenService } from '~/junior/services';
|
import { JuniorTokenService } from '~/junior/services';
|
||||||
|
import { User } from '../../user/entities';
|
||||||
|
|
||||||
|
import { DeviceService, UserService } from '~/user/services';
|
||||||
import { PASSCODE_REGEX, PASSWORD_REGEX } from '../constants';
|
import { PASSCODE_REGEX, PASSWORD_REGEX } from '../constants';
|
||||||
import {
|
import {
|
||||||
CreateUnverifiedUserRequestDto,
|
CreateUnverifiedUserRequestDto,
|
||||||
@ -19,12 +22,9 @@ import {
|
|||||||
setJuniorPasswordRequestDto,
|
setJuniorPasswordRequestDto,
|
||||||
} from '../dtos/request';
|
} from '../dtos/request';
|
||||||
import { VerifyUserRequestDto } from '../dtos/request/verify-user.request.dto';
|
import { VerifyUserRequestDto } from '../dtos/request/verify-user.request.dto';
|
||||||
import { User } from '../entities';
|
|
||||||
import { GrantType, Roles } from '../enums';
|
import { GrantType, Roles } from '../enums';
|
||||||
import { IJwtPayload, ILoginResponse } from '../interfaces';
|
import { IJwtPayload, ILoginResponse } from '../interfaces';
|
||||||
import { removePadding, verifySignature } from '../utils';
|
import { removePadding, verifySignature } from '../utils';
|
||||||
import { DeviceService } from './device.service';
|
|
||||||
import { UserService } from './user.service';
|
|
||||||
|
|
||||||
const ONE_THOUSAND = 1000;
|
const ONE_THOUSAND = 1000;
|
||||||
const SALT_ROUNDS = 10;
|
const SALT_ROUNDS = 10;
|
||||||
|
@ -1,3 +1 @@
|
|||||||
export * from './auth.service';
|
export * from './auth.service';
|
||||||
export * from './device.service';
|
|
||||||
export * from './user.service';
|
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
PrimaryGeneratedColumn,
|
PrimaryGeneratedColumn,
|
||||||
UpdateDateColumn,
|
UpdateDateColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { User } from '~/auth/entities';
|
import { User } from '~/user/entities';
|
||||||
import { NotificationChannel, NotificationScope, NotificationStatus } from '../enums';
|
import { NotificationChannel, NotificationScope, NotificationStatus } from '../enums';
|
||||||
|
|
||||||
@Entity('notifications')
|
@Entity('notifications')
|
||||||
|
@ -2,8 +2,8 @@ import { Module } from '@nestjs/common';
|
|||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { TwilioModule } from 'nestjs-twilio';
|
import { TwilioModule } from 'nestjs-twilio';
|
||||||
import { AuthModule } from '~/auth/auth.module';
|
|
||||||
import { buildTwilioOptions } from '~/core/module-options';
|
import { buildTwilioOptions } from '~/core/module-options';
|
||||||
|
import { UserModule } from '~/user/user.module';
|
||||||
import { NotificationsController } from './controllers';
|
import { NotificationsController } from './controllers';
|
||||||
import { Notification } from './entities';
|
import { Notification } from './entities';
|
||||||
import { NotificationsRepository } from './repositories';
|
import { NotificationsRepository } from './repositories';
|
||||||
@ -17,7 +17,7 @@ import { TwilioService } from './services/twilio.service';
|
|||||||
useFactory: buildTwilioOptions,
|
useFactory: buildTwilioOptions,
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
}),
|
}),
|
||||||
AuthModule,
|
UserModule,
|
||||||
],
|
],
|
||||||
providers: [NotificationsService, FirebaseService, NotificationsRepository, TwilioService],
|
providers: [NotificationsService, FirebaseService, NotificationsRepository, TwilioService],
|
||||||
exports: [NotificationsService],
|
exports: [NotificationsService],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { EventEmitter2, OnEvent } from '@nestjs/event-emitter';
|
import { EventEmitter2, OnEvent } from '@nestjs/event-emitter';
|
||||||
import { DeviceService } from '~/auth/services';
|
|
||||||
import { PageOptionsRequestDto } from '~/core/dtos';
|
import { PageOptionsRequestDto } from '~/core/dtos';
|
||||||
|
import { DeviceService } from '~/user/services';
|
||||||
import { OTP_BODY, OTP_TITLE } from '../../otp/constants';
|
import { OTP_BODY, OTP_TITLE } from '../../otp/constants';
|
||||||
import { OtpType } from '../../otp/enums';
|
import { OtpType } from '../../otp/enums';
|
||||||
import { ISendOtp } from '../../otp/interfaces';
|
import { ISendOtp } from '../../otp/interfaces';
|
||||||
@ -18,7 +18,7 @@ export class NotificationsService {
|
|||||||
private readonly notificationRepository: NotificationsRepository,
|
private readonly notificationRepository: NotificationsRepository,
|
||||||
private readonly twilioService: TwilioService,
|
private readonly twilioService: TwilioService,
|
||||||
private readonly eventEmitter: EventEmitter2,
|
private readonly eventEmitter: EventEmitter2,
|
||||||
@Inject(forwardRef(() => DeviceService)) private readonly deviceService: DeviceService,
|
private readonly deviceService: DeviceService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async sendPushNotification(userId: string, title: string, body: string) {
|
async sendPushNotification(userId: string, title: string, body: string) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Column, CreateDateColumn, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
import { Column, CreateDateColumn, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { User } from '~/auth/entities';
|
import { User } from '~/user/entities';
|
||||||
import { OtpScope, OtpType } from '../enums';
|
import { OtpScope, OtpType } from '../enums';
|
||||||
|
|
||||||
@Entity('otp')
|
@Entity('otp')
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { forwardRef, Module } from '@nestjs/common';
|
import { forwardRef, Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { AuthModule } from '~/auth/auth.module';
|
import { UserModule } from '~/user/user.module';
|
||||||
import { CustomerController } from './controllers';
|
import { CustomerController } from './controllers';
|
||||||
import { Customer } from './entities';
|
import { Customer } from './entities';
|
||||||
import { CustomerNotificationSettings } from './entities/customer-notification-settings.entity';
|
import { CustomerNotificationSettings } from './entities/customer-notification-settings.entity';
|
||||||
@ -8,7 +8,7 @@ import { CustomerRepository } from './repositories/customer.repository';
|
|||||||
import { CustomerService } from './services';
|
import { CustomerService } from './services';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([Customer, CustomerNotificationSettings]), forwardRef(() => AuthModule)],
|
imports: [TypeOrmModule.forFeature([Customer, CustomerNotificationSettings]), forwardRef(() => UserModule)],
|
||||||
controllers: [CustomerController],
|
controllers: [CustomerController],
|
||||||
providers: [CustomerService, CustomerRepository],
|
providers: [CustomerService, CustomerRepository],
|
||||||
exports: [CustomerService],
|
exports: [CustomerService],
|
||||||
|
@ -29,5 +29,6 @@ export class UpdateCustomerRequestDto {
|
|||||||
|
|
||||||
@ApiProperty({ example: '123e4567-e89b-12d3-a456-426614174000' })
|
@ApiProperty({ example: '123e4567-e89b-12d3-a456-426614174000' })
|
||||||
@IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'customer.profilePictureId' }) })
|
@IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'customer.profilePictureId' }) })
|
||||||
|
@IsOptional()
|
||||||
profilePictureId!: string;
|
profilePictureId!: string;
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,10 @@ import {
|
|||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
UpdateDateColumn,
|
UpdateDateColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { User } from '~/auth/entities';
|
|
||||||
import { Document } from '~/document/entities';
|
import { Document } from '~/document/entities';
|
||||||
import { Guardian } from '~/guardian/entities/guradian.entity';
|
import { Guardian } from '~/guardian/entities/guradian.entity';
|
||||||
import { Junior } from '~/junior/entities';
|
import { Junior } from '~/junior/entities';
|
||||||
|
import { User } from '~/user/entities';
|
||||||
import { CustomerNotificationSettings } from './customer-notification-settings.entity';
|
import { CustomerNotificationSettings } from './customer-notification-settings.entity';
|
||||||
|
|
||||||
@Entity('customers')
|
@Entity('customers')
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { FindOptionsWhere, Repository } from 'typeorm';
|
import { FindOptionsWhere, Repository } from 'typeorm';
|
||||||
import { User } from '~/auth/entities';
|
|
||||||
import { Roles } from '~/auth/enums';
|
import { Roles } from '~/auth/enums';
|
||||||
|
import { User } from '~/user/entities';
|
||||||
import { UpdateNotificationsSettingsRequestDto } from '../dtos/request';
|
import { UpdateNotificationsSettingsRequestDto } from '../dtos/request';
|
||||||
import { Customer } from '../entities';
|
import { Customer } from '../entities';
|
||||||
import { CustomerNotificationSettings } from '../entities/customer-notification-settings.entity';
|
import { CustomerNotificationSettings } from '../entities/customer-notification-settings.entity';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { BadRequestException, forwardRef, Inject, Injectable } from '@nestjs/common';
|
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||||
import { User } from '~/auth/entities';
|
|
||||||
import { DeviceService } from '~/auth/services';
|
|
||||||
import { OciService } from '~/document/services';
|
import { OciService } from '~/document/services';
|
||||||
|
import { User } from '~/user/entities';
|
||||||
|
import { DeviceService } from '~/user/services';
|
||||||
import { UpdateCustomerRequestDto, UpdateNotificationsSettingsRequestDto } from '../dtos/request';
|
import { UpdateCustomerRequestDto, UpdateNotificationsSettingsRequestDto } from '../dtos/request';
|
||||||
import { Customer } from '../entities';
|
import { Customer } from '../entities';
|
||||||
import { CustomerRepository } from '../repositories/customer.repository';
|
import { CustomerRepository } from '../repositories/customer.repository';
|
||||||
@ -11,7 +11,7 @@ export class CustomerService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly customerRepository: CustomerRepository,
|
private readonly customerRepository: CustomerRepository,
|
||||||
private readonly ociService: OciService,
|
private readonly ociService: OciService,
|
||||||
@Inject(forwardRef(() => DeviceService)) private readonly deviceService: DeviceService,
|
private readonly deviceService: DeviceService,
|
||||||
) {}
|
) {}
|
||||||
async updateNotificationSettings(userId: string, data: UpdateNotificationsSettingsRequestDto, deviceId: string) {
|
async updateNotificationSettings(userId: string, data: UpdateNotificationsSettingsRequestDto, deviceId: string) {
|
||||||
const customer = await this.findCustomerById(userId);
|
const customer = await this.findCustomerById(userId);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { Column, Entity, OneToMany, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
import { Column, Entity, OneToMany, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
import { User } from '~/auth/entities';
|
|
||||||
import { Customer } from '~/customer/entities';
|
import { Customer } from '~/customer/entities';
|
||||||
import { Gift } from '~/gift/entities';
|
import { Gift } from '~/gift/entities';
|
||||||
import { Junior, Theme } from '~/junior/entities';
|
import { Junior, Theme } from '~/junior/entities';
|
||||||
import { SavingGoal } from '~/saving-goals/entities';
|
import { SavingGoal } from '~/saving-goals/entities';
|
||||||
import { Task } from '~/task/entities';
|
import { Task } from '~/task/entities';
|
||||||
import { TaskSubmission } from '~/task/entities/task-submissions.entity';
|
import { TaskSubmission } from '~/task/entities/task-submissions.entity';
|
||||||
|
import { User } from '~/user/entities';
|
||||||
import { DocumentType } from '../enums';
|
import { DocumentType } from '../enums';
|
||||||
|
|
||||||
@Entity('documents')
|
@Entity('documents')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { forwardRef, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { AuthModule } from '~/auth/auth.module';
|
|
||||||
import { CustomerModule } from '~/customer/customer.module';
|
import { CustomerModule } from '~/customer/customer.module';
|
||||||
|
import { UserModule } from '~/user/user.module';
|
||||||
import { JuniorController } from './controllers';
|
import { JuniorController } from './controllers';
|
||||||
import { Junior, JuniorRegistrationToken, Theme } from './entities';
|
import { Junior, JuniorRegistrationToken, Theme } from './entities';
|
||||||
import { JuniorRepository, JuniorTokenRepository } from './repositories';
|
import { JuniorRepository, JuniorTokenRepository } from './repositories';
|
||||||
@ -10,11 +10,7 @@ import { JuniorService, JuniorTokenService, QrcodeService } from './services';
|
|||||||
@Module({
|
@Module({
|
||||||
controllers: [JuniorController],
|
controllers: [JuniorController],
|
||||||
providers: [JuniorService, JuniorRepository, JuniorTokenService, JuniorTokenRepository, QrcodeService],
|
providers: [JuniorService, JuniorRepository, JuniorTokenService, JuniorTokenRepository, QrcodeService],
|
||||||
imports: [
|
imports: [TypeOrmModule.forFeature([Junior, Theme, JuniorRegistrationToken]), UserModule, CustomerModule],
|
||||||
TypeOrmModule.forFeature([Junior, Theme, JuniorRegistrationToken]),
|
|
||||||
forwardRef(() => AuthModule),
|
|
||||||
CustomerModule,
|
|
||||||
],
|
|
||||||
exports: [JuniorService, JuniorTokenService],
|
exports: [JuniorService, JuniorTokenService],
|
||||||
})
|
})
|
||||||
export class JuniorModule {}
|
export class JuniorModule {}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { BadRequestException, forwardRef, Inject, Injectable } from '@nestjs/common';
|
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||||
import { Transactional } from 'typeorm-transactional';
|
import { Transactional } from 'typeorm-transactional';
|
||||||
import { Roles } from '~/auth/enums';
|
import { Roles } from '~/auth/enums';
|
||||||
import { UserService } from '~/auth/services';
|
|
||||||
import { PageOptionsRequestDto } from '~/core/dtos';
|
import { PageOptionsRequestDto } from '~/core/dtos';
|
||||||
import { CustomerNotificationSettings } from '~/customer/entities/customer-notification-settings.entity';
|
import { CustomerNotificationSettings } from '~/customer/entities/customer-notification-settings.entity';
|
||||||
import { CustomerService } from '~/customer/services';
|
import { CustomerService } from '~/customer/services';
|
||||||
|
import { UserService } from '~/user/services';
|
||||||
import { CreateJuniorRequestDto, SetThemeRequestDto } from '../dtos/request';
|
import { CreateJuniorRequestDto, SetThemeRequestDto } from '../dtos/request';
|
||||||
import { Junior } from '../entities';
|
import { Junior } from '../entities';
|
||||||
import { JuniorRepository } from '../repositories';
|
import { JuniorRepository } from '../repositories';
|
||||||
@ -15,8 +15,8 @@ export class JuniorService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly juniorRepository: JuniorRepository,
|
private readonly juniorRepository: JuniorRepository,
|
||||||
private readonly juniorTokenService: JuniorTokenService,
|
private readonly juniorTokenService: JuniorTokenService,
|
||||||
@Inject(forwardRef(() => UserService)) private readonly userService: UserService,
|
private readonly userService: UserService,
|
||||||
@Inject(forwardRef(() => CustomerService)) private readonly customerService: CustomerService,
|
private readonly customerService: CustomerService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@Transactional()
|
@Transactional()
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
import { Notification } from '~/common/modules/notification/entities';
|
import { Notification } from '~/common/modules/notification/entities';
|
||||||
import { Otp } from '~/common/modules/otp/entities';
|
import { Otp } from '~/common/modules/otp/entities';
|
||||||
import { Customer } from '~/customer/entities/customer.entity';
|
import { Customer } from '~/customer/entities/customer.entity';
|
||||||
import { Roles } from '../enums';
|
import { Roles } from '../../auth/enums';
|
||||||
import { Device } from './device.entity';
|
import { Device } from './device.entity';
|
||||||
|
|
||||||
@Entity('users')
|
@Entity('users')
|
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { IsNull, Not, Repository } from 'typeorm';
|
import { IsNull, Not, Repository } from 'typeorm';
|
||||||
import { Device } from '../entities';
|
import { Device } from '../../user/entities';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DeviceRepository {
|
export class DeviceRepository {
|
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { FindOptionsWhere, Repository } from 'typeorm';
|
import { FindOptionsWhere, Repository } from 'typeorm';
|
||||||
import { User } from '../entities';
|
import { User } from '../../user/entities';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserRepository {
|
export class UserRepository {
|
2
src/user/services/index.ts
Normal file
2
src/user/services/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './device.service';
|
||||||
|
export * from './user.service';
|
@ -3,9 +3,9 @@ import { FindOptionsWhere } from 'typeorm';
|
|||||||
import { CustomerNotificationSettings } from '~/customer/entities/customer-notification-settings.entity';
|
import { CustomerNotificationSettings } from '~/customer/entities/customer-notification-settings.entity';
|
||||||
import { CustomerService } from '~/customer/services';
|
import { CustomerService } from '~/customer/services';
|
||||||
import { Guardian } from '~/guardian/entities/guradian.entity';
|
import { Guardian } from '~/guardian/entities/guradian.entity';
|
||||||
import { CreateUnverifiedUserRequestDto } from '../dtos/request';
|
import { CreateUnverifiedUserRequestDto } from '../../auth/dtos/request';
|
||||||
|
import { Roles } from '../../auth/enums';
|
||||||
import { User } from '../entities';
|
import { User } from '../entities';
|
||||||
import { Roles } from '../enums';
|
|
||||||
import { UserRepository } from '../repositories';
|
import { UserRepository } from '../repositories';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
13
src/user/user.module.ts
Normal file
13
src/user/user.module.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { forwardRef, Module } from '@nestjs/common';
|
||||||
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
|
import { CustomerModule } from '~/customer/customer.module';
|
||||||
|
import { Device, User } from './entities';
|
||||||
|
import { DeviceRepository, UserRepository } from './repositories';
|
||||||
|
import { DeviceService, UserService } from './services';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [TypeOrmModule.forFeature([User, Device]), forwardRef(() => CustomerModule)],
|
||||||
|
providers: [UserService, DeviceService, UserRepository, DeviceRepository],
|
||||||
|
exports: [UserService, DeviceService],
|
||||||
|
})
|
||||||
|
export class UserModule {}
|
Reference in New Issue
Block a user