Merge branch 'main' of https://github.com/Danakcorp/danak_dsc_api
This commit is contained in:
+2
-1
@@ -82,5 +82,6 @@
|
||||
"git add ."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@9.15.3+sha512.1f79bc245a66eb0b07c5d4d83131240774642caaa86ef7d0434ab47c0d16f66b04e21e0c086eb61e62c77efc4d7f7ec071afad3796af64892fae66509173893a"
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,7 +1,10 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
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';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -10,8 +13,10 @@ import { DatabaseConfigs } from "./configs/typeorm.config";
|
||||
isGlobal: true,
|
||||
}),
|
||||
TypeOrmModule.forRootAsync(DatabaseConfigs()),
|
||||
UsersModule,
|
||||
TicketsModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
export class AppModule {}
|
||||
export class AppModule { }
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { CreateDateColumn, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
|
||||
|
||||
export abstract class BaseEntity {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('tickets')
|
||||
export class TicketsController {}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TicketsService } from './tickets.service';
|
||||
import { TicketsController } from './tickets.controller';
|
||||
|
||||
@Module({
|
||||
providers: [TicketsService],
|
||||
controllers: [TicketsController]
|
||||
})
|
||||
export class TicketsModule {}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class TicketsService {}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity()
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({ type: "varchar", length: 150, unique: true })
|
||||
email: string;
|
||||
|
||||
@Column({ type: "varchar", length: 11, unique: true })
|
||||
phoneNumber: string;
|
||||
|
||||
@Column({ type: "varchar", length: 150 })
|
||||
password: string;
|
||||
|
||||
@Column({ type: "varchar", length: 150 })
|
||||
fistName: string;
|
||||
|
||||
@Column({ type: "varchar", length: 200 })
|
||||
lastName: string;
|
||||
|
||||
@Column()
|
||||
birthDate: string;
|
||||
|
||||
@Column({ type: "varchar", length: 100 })
|
||||
nationalCode: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectRepository } from "@nestjs/typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
|
||||
import { User } from "../entities/user.entity";
|
||||
|
||||
@Injectable()
|
||||
export class UserRepository extends Repository<User> {
|
||||
constructor(@InjectRepository(User) private userRepository: Repository<User>) {
|
||||
super(userRepository.target, userRepository.manager, userRepository.queryRunner);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { Controller } from "@nestjs/common";
|
||||
|
||||
@Controller("users")
|
||||
export class UsersController {}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
|
||||
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])],
|
||||
providers: [UsersService, UserRepository],
|
||||
controllers: [UsersController],
|
||||
exports: [UsersService, TypeOrmModule],
|
||||
})
|
||||
export class UsersModule {}
|
||||
Reference in New Issue
Block a user