mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-14 20:49:42 +03:00
Added user model
This commit is contained in:
14
backend/libs/database/user.entity.ts
Normal file
14
backend/libs/database/user.entity.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Column, Entity, PrimaryColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class User {
|
||||
constructor(props?: Partial<User>) {
|
||||
Object.assign(this, props);
|
||||
}
|
||||
|
||||
@PrimaryColumn()
|
||||
public id!: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
public user_name: string;
|
||||
}
|
||||
8
backend/libs/libs.module.ts
Normal file
8
backend/libs/libs.module.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { User } from './database/user.entity';
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([User])],
|
||||
exports: [TypeOrmModule],
|
||||
})
|
||||
export class LibsModule {}
|
||||
11
backend/src/modules/initialization/app.init.service.ts
Normal file
11
backend/src/modules/initialization/app.init.service.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { User } from 'libs/database/user.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class AppInitService implements OnModuleInit {
|
||||
constructor(@InjectRepository(User) private userRepository: Repository<User>) {}
|
||||
|
||||
async onModuleInit() {}
|
||||
}
|
||||
Reference in New Issue
Block a user