Merge branch 'main' of https://github.com/Danakcorp/danak_dsc_api
This commit is contained in:
+2
-2
@@ -3,8 +3,8 @@ import { ConfigModule } from "@nestjs/config";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
|
||||
import { DatabaseConfigs } from "./configs/typeorm.config";
|
||||
import { UsersModule } from './modules/users/users.module';
|
||||
import { TicketsModule } from './modules/tickets/tickets.module';
|
||||
import { TicketsModule } from "./modules/tickets/tickets.module";
|
||||
import { UsersModule } from "./modules/users/users.module";
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
||||
@@ -12,11 +12,11 @@ export function DatabaseConfigs(): TypeOrmModuleAsyncOptions {
|
||||
database: configService.getOrThrow<string>("DB_NAME"),
|
||||
username: configService.getOrThrow<string>("DB_USER"),
|
||||
password: configService.getOrThrow<string>("DB_PASS"),
|
||||
autoLoadEntities: true,
|
||||
synchronize: true,
|
||||
logging: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
|
||||
migrationsTableName: "typeorm_migrations",
|
||||
migrationsRun: false,
|
||||
autoLoadEntities: true,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ async function bootstrap() {
|
||||
getSwaggerDocument(app);
|
||||
|
||||
const PORT = configService.getOrThrow<number>("PORT");
|
||||
await app.listen(PORT, () => {
|
||||
await app.listen(PORT, "0.0.0.0", () => {
|
||||
logger.log(`Server running on http://localhost:${PORT}`);
|
||||
logger.log(`Swagger running on http://localhost:${PORT}/api-docs`);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
import { Controller } from "@nestjs/common";
|
||||
import { ApiTags } from "@nestjs/swagger";
|
||||
|
||||
@Controller('tickets')
|
||||
@Controller("tickets")
|
||||
@ApiTags("users")
|
||||
export class TicketsController {}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BaseEntity, Column, Entity } from "typeorm";
|
||||
import { Column, Entity } from "typeorm";
|
||||
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { RoleEnum } from "../enums/role.enum";
|
||||
|
||||
@Entity()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Column, Entity, OneToOne } from "typeorm";
|
||||
import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
|
||||
|
||||
import { Role } from "./role.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
@@ -26,6 +26,7 @@ export class User extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 100 })
|
||||
nationalCode: string;
|
||||
|
||||
@OneToOne(() => Role, { eager: true, cascade: true, onDelete: "SET NULL" })
|
||||
@JoinColumn()
|
||||
@OneToOne(() => Role, { eager: true, cascade: true, onDelete: "RESTRICT", nullable: false })
|
||||
role: Role;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Controller } from "@nestjs/common";
|
||||
import { ApiTags } from "@nestjs/swagger";
|
||||
|
||||
@Controller("users")
|
||||
@ApiTags("users")
|
||||
export class UsersController {}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
|
||||
import { Role } from "./entities/role.entity";
|
||||
import { User } from "./entities/user.entity";
|
||||
import { UserRepository } from "./providers/users.repository";
|
||||
import { UsersService } from "./providers/users.service";
|
||||
import { UsersController } from "./users.controller";
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([User])],
|
||||
imports: [TypeOrmModule.forFeature([User, Role])],
|
||||
providers: [UsersService, UserRepository],
|
||||
controllers: [UsersController],
|
||||
exports: [UsersService, TypeOrmModule],
|
||||
|
||||
Reference in New Issue
Block a user