diff --git a/src/app.module.ts b/src/app.module.ts index 85668e3..fc80823 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -9,7 +9,6 @@ import { HealthModule } from './health/health.module'; import { LicenseeModule } from './licensee/licensee.module'; import { SoftwareModule } from './software/software.module'; import { AuthModule } from './auth/auth.module'; -import { UsersModule } from './users/users.module'; import { AppController } from './app.controller'; @Module({ @@ -22,7 +21,6 @@ import { AppController } from './app.controller'; HealthModule, HttpModule, AuthModule, - UsersModule, ], controllers: [AppController], providers: [], diff --git a/src/migrations/1660753342273-removeUsers.ts b/src/migrations/1660753342273-removeUsers.ts new file mode 100644 index 0000000..4471e19 --- /dev/null +++ b/src/migrations/1660753342273-removeUsers.ts @@ -0,0 +1,13 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class removeUsers1660753342273 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE "users"`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "users" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "created" TIMESTAMP NOT NULL DEFAULT now(), "modified" TIMESTAMP NOT NULL DEFAULT now(), "username" text NOT NULL, "email" character varying NOT NULL, "role" text, CONSTRAINT "UQ_97672ac88f789774dd47f7c8be3" UNIQUE ("email"), CONSTRAINT "PK_a3ffb1c0c8416b9fc6f907b7433" PRIMARY KEY ("id"))`, + ); + } +} diff --git a/src/users/user.entity.ts b/src/users/user.entity.ts deleted file mode 100644 index 90b8b93..0000000 --- a/src/users/user.entity.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { GenericEntity } from 'src/common/generic.entity'; -import { Column, Entity } from 'typeorm'; - -@Entity('users') -export class UserEntity extends GenericEntity { - @ApiProperty() - @Column('text', { nullable: false }) - username: string; - - @ApiProperty() - @Column({ - unique: true, - }) - email: string; - - @ApiProperty() - @Column('text', { nullable: true }) - role: string; -} diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts deleted file mode 100644 index de16bfd..0000000 --- a/src/users/users.controller.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Controller } from '@nestjs/common'; -import { Crud, CrudController } from '@nestjsx/crud'; -import { UserEntity } from './user.entity'; -import { UsersService } from './users.service'; - -@Crud({ - params: { - id: { - field: 'id', - type: 'uuid', - primary: true, - }, - }, - model: { type: UserEntity }, -}) -@Controller('users') -export class UsersController implements CrudController { - constructor(public service: UsersService) {} -} diff --git a/src/users/users.module.ts b/src/users/users.module.ts deleted file mode 100644 index 4eb325f..0000000 --- a/src/users/users.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { UserEntity } from './user.entity'; -import { UsersService } from './users.service'; - -@Module({ - imports: [TypeOrmModule.forFeature([UserEntity])], - providers: [UsersService], - exports: [UsersService], -}) -export class UsersModule {} diff --git a/src/users/users.service.spec.ts b/src/users/users.service.spec.ts deleted file mode 100644 index d0cd4ab..0000000 --- a/src/users/users.service.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { UsersService } from './users.service'; - -describe('UsersService', () => { - let service: UsersService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [UsersService], - }).compile(); - - service = module.get(UsersService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); diff --git a/src/users/users.service.ts b/src/users/users.service.ts deleted file mode 100644 index c3ba8a5..0000000 --- a/src/users/users.service.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { TypeOrmCrudService } from '@nestjsx/crud-typeorm'; -import { UserEntity } from './user.entity'; - -@Injectable() -export class UsersService extends TypeOrmCrudService { - constructor(@InjectRepository(UserEntity) repo) { - super(repo); - } -} diff --git a/technical.md b/technical.md index 8c0ed74..75a1a28 100644 --- a/technical.md +++ b/technical.md @@ -11,6 +11,9 @@ erDiagram licensee { string id string name + string email + string role + string notes date created date modified } @@ -19,6 +22,7 @@ erDiagram string title string publisher string administrator + string notes number quantity date renewal date created