refactor: changed the project structure
This commit is contained in:
+6
-6
@@ -2,14 +2,14 @@ import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { validationSchema } from './config/config.validation';
|
||||
import { UsersModule } from './users/users.module';
|
||||
import { UsersModule } from './modules/users/users.module';
|
||||
import { databaseConfig } from './config/typeorm.config';
|
||||
import { HttpModule } from '@nestjs/axios';
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import { OrganModule } from './organ/organ.module';
|
||||
import { ComplaintModule } from './complaint/complaint.module';
|
||||
import { AttachmentModule } from './attachment/attachment.module';
|
||||
import { ReplyModule } from './reply/reply.module';
|
||||
import { AuthModule } from './modules/auth/auth.module';
|
||||
import { OrganModule } from './modules/organ/organ.module';
|
||||
import { ComplaintModule } from './modules/complaint/complaint.module';
|
||||
import { AttachmentModule } from './modules/attachment/attachment.module';
|
||||
import { ReplyModule } from './modules/reply/reply.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { applyDecorators, UseGuards } from "@nestjs/common";
|
||||
import { ApiBearerAuth } from "@nestjs/swagger";
|
||||
import { JwtAuthGuard } from "src/auth/guards/jwt-auth.guard";
|
||||
import { JwtAuthGuard } from "src/modules/auth/guards/jwt-auth.guard";
|
||||
|
||||
export function AuthGuard() {
|
||||
return applyDecorators(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
|
||||
import { IRequest } from 'src/auth/interfaces/IRequest';
|
||||
import { ITokenPayload } from 'src/auth/interfaces/IToken-payload';
|
||||
import { IRequest } from 'src/modules/auth/interfaces/IRequest';
|
||||
import { ITokenPayload } from 'src/modules/auth/interfaces/IToken-payload';
|
||||
|
||||
export const UserDec = createParamDecorator(
|
||||
(data: keyof ITokenPayload | undefined, ctx: ExecutionContext) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FactoryProvider } from "@nestjs/common";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
|
||||
import { SMS_CONFIG } from "src/utils/constants";
|
||||
import { SMS_CONFIG } from "src/modules/utils/constants";
|
||||
|
||||
export const smsConfigsProvider: FactoryProvider<ISmsConfigs> = {
|
||||
provide: SMS_CONFIG,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { BaseEntity } from "src/common/entities/base.entity";
|
||||
import { Column, Entity, OneToOne } from "typeorm";
|
||||
import { AttachmentType } from "../enums/attachment-type.enum";
|
||||
import { ComplaintAttachment } from "src/complaint/entities/complaint-attachment.entity";
|
||||
import { ReplyAttachment } from "src/reply/entities/reply-attachment.entity";
|
||||
import { ComplaintAttachment } from "src/modules/complaint/entities/complaint-attachment.entity";
|
||||
import { ReplyAttachment } from "src/modules/reply/entities/reply-attachment.entity";
|
||||
|
||||
@Entity('attachments')
|
||||
export class Attachment extends BaseEntity{
|
||||
@@ -2,14 +2,11 @@ import { Module } from '@nestjs/common';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { AuthController } from './auth.controller';
|
||||
import { AuthService } from './auth.service';
|
||||
import { UtilsModule } from 'src/utils/utils.module';
|
||||
import { UtilsModule } from '../utils/utils.module';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { User } from 'src/users/entities/user.entity';
|
||||
import { OTP } from './entities/otp.entity';
|
||||
import { OtpRepository } from './repositories/otp.repository';
|
||||
import { UsersModule } from 'src/users/users.module';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { UserRole } from 'src/users/entities/user-role.entity';
|
||||
import { UsersModule } from 'src/modules/users/users.module';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { JwtStrategy } from './strategies/jwt.strategy';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import type { ISmsConfigs } from 'src/config/sms.config';
|
||||
import { SMS_CONFIG } from 'src/utils/constants';
|
||||
import { SmsService } from 'src/utils/providers/sms.service';
|
||||
import { SMS_CONFIG } from '../utils/constants';
|
||||
import { SmsService } from '../utils/providers/sms.service';
|
||||
import { OtpRepository } from './repositories/otp.repository';
|
||||
import { OtpStatus } from './enums/otp-status.enum';
|
||||
import { VerifyOtpDto } from './DTO/verify-otp.dto';
|
||||
import { OTPMessages, UserMessages } from 'src/common/enums/messages.enum';
|
||||
import { LoginCredentialDto } from './DTO/login-credential.dto';
|
||||
import { UsersService } from 'src/users/users.service';
|
||||
import { UsersService } from 'src/modules/users/users.service';
|
||||
import * as bcrypt from 'bcrypt';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import ms from 'ms';
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { RoleType } from "src/users/enums/user-role.enum";
|
||||
import { RoleType } from "src/modules/users/enums/user-role.enum";
|
||||
|
||||
export interface ITokenPayload {
|
||||
id: string;
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { RoleType } from 'src/users/enums/user-role.enum';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Strategy, ExtractJwt } from 'passport-jwt';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { BaseEntity } from "src/common/entities/base.entity";
|
||||
import { Entity, JoinColumn, ManyToOne, OneToOne, Unique } from "typeorm";
|
||||
import { Complaint } from "./complaint.entity";
|
||||
import { Attachment } from "src/attachment/entities/attachment.entity";
|
||||
import { Attachment } from "src/modules/attachment/entities/attachment.entity";
|
||||
|
||||
@Entity('complaint_attachments')
|
||||
@Unique(['attachment'])
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne } from 'typeorm';
|
||||
import { ComplaintStatus } from '../enums/complaint.enum';
|
||||
import { User } from 'src/users/entities/user.entity';
|
||||
import { Organ } from 'src/organ/entities/organ.entity';
|
||||
import { User } from 'src/modules/users/entities/user.entity';
|
||||
import { Organ } from 'src/modules/organ/entities/organ.entity';
|
||||
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||
import { ComplaintAttachment } from './complaint-attachment.entity';
|
||||
import { Reply } from 'src/reply/entities/reply.entity';
|
||||
import { Reply } from 'src/modules/reply/entities/reply.entity';
|
||||
|
||||
@Entity('complaints')
|
||||
export class Complaint extends BaseEntity {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||
import { Complaint } from 'src/complaint/entities/complaint.entity';
|
||||
import { Complaint } from 'src/modules/complaint/entities/complaint.entity';
|
||||
import { Column, Entity, OneToMany } from 'typeorm';
|
||||
|
||||
@Entity('organs')
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { BaseEntity } from "src/common/entities/base.entity";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from "typeorm";
|
||||
import { Reply } from "./reply.entity";
|
||||
import { Attachment } from "src/attachment/entities/attachment.entity";
|
||||
import { Attachment } from "src/modules/attachment/entities/attachment.entity";
|
||||
|
||||
@Entity('reply_attachments')
|
||||
export class ReplyAttachment extends BaseEntity {
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Attachment } from "src/attachment/entities/attachment.entity";
|
||||
import { Attachment } from "src/modules/attachment/entities/attachment.entity";
|
||||
import { BaseEntity } from "src/common/entities/base.entity";
|
||||
import { Complaint } from "src/complaint/entities/complaint.entity";
|
||||
import { User } from "src/users/entities/user.entity";
|
||||
import { Complaint } from "src/modules/complaint/entities/complaint.entity";
|
||||
import { User } from "src/modules/users/entities/user.entity";
|
||||
import { Column, Entity, ManyToOne, OneToMany } from "typeorm";
|
||||
import { ReplyAttachment } from "./reply-attachment.entity";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Entity, Column, ManyToMany, JoinTable, OneToMany } from 'typeorm';
|
||||
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||
import { Exclude } from 'class-transformer';
|
||||
import { UserRole } from './user-role.entity';
|
||||
import { Complaint } from 'src/complaint/entities/complaint.entity';
|
||||
import { Complaint } from 'src/modules/complaint/entities/complaint.entity';
|
||||
|
||||
@Entity('users')
|
||||
export class User extends BaseEntity {
|
||||
Reference in New Issue
Block a user