feat: upgraded nx, added databae service

This commit is contained in:
Krzysztof Rudnicki 2024-05-30 23:05:17 +02:00
parent a0316edce7
commit fe53aabc17
12 changed files with 1310 additions and 2186 deletions

View File

@ -2,6 +2,11 @@
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
"firsttris.vscode-jest-runner",
"angular.ng-template",
"wesbos.theme-cobalt2",
"dbaeumer.vscode-eslint",
"wix.vscode-import-cost",
"prisma.prisma"
]
}

View File

@ -7,65 +7,36 @@ datasource db {
url = env("DATABASE_URL")
}
model Restauracja {
id Int @id @default(autoincrement())
adres String
znizkas Znizka[] @relation("RestauracjaZnizka")
recenzjas Recenzja[] @relation("RestauracjaRecenzja")
}
model Recenzja {
id Int @id @default(autoincrement())
tekst String
wartosc Int
restauracjaId Int
uzytkownikId Int
restauracja Restauracja @relation("RestauracjaRecenzja", fields: [restauracjaId], references: [id])
uzytkownik Uzytkownik @relation("UzytkownikRecenzja", fields: [uzytkownikId], references: [id])
model Recencja {
id Int @id @default(autoincrement())
tekst String
wartosc Int
}
model Uzytkownik {
id Int @id @default(autoincrement())
imie String
nazwisko String
adres String
Historia_zamowienId Int @unique
recenzjas Recenzja[] @relation("UzytkownikRecenzja")
historia_zamowien Historia_zamowien @relation("HistoriaRelation", fields: [Historia_zamowienId], references: [id])
id Int @id @default(autoincrement())
imie String
nazwisko String
adres String
}
model Historia_zamowien {
id Int @id @default(autoincrement())
data_zamowienia DateTime
HistoriaUzytkownik Uzytkownik? @relation("HistoriaRelation")
id Int @id @default(autoincrement())
data_zamowienia DateTime
}
model Danie {
id Int @id @default(autoincrement())
cena Int
kategoria String
nazwa String
zamowioneDanias Zamowione_danie[] @relation("DanieZamowione_danie")
id Int @id @default(autoincrement())
cena Int
kategoria String
nazwa String
}
model Zamowione_danie {
id Int @id @default(autoincrement())
zamowienie Zamowienie @relation(fields: [zamowienieId], references: [id])
zamowienieId Int @unique
danias Danie[] @relation("DanieZamowione_danie")
id Int @id @default(autoincrement())
}
model Zamowienie {
id Int @id @default(autoincrement())
status String
zamowioneDanie Zamowione_danie?
}
model Znizka {
id Int @id @default(autoincrement())
kod String
wartosc Int
czy_dostepna Boolean
restauracjaId Int
restauracja Restauracja @relation("RestauracjaZnizka", fields: [restauracjaId], references: [id])
id Int @id @default(autoincrement())
status String
}

View File

@ -2,9 +2,10 @@ import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { DatabaseModule } from './database/database.module';
@Module({
imports: [],
imports: [DatabaseModule],
controllers: [AppController],
providers: [AppService],
})

View File

@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { DatabaseController } from './database.controller';
describe('DatabaseController', () => {
let controller: DatabaseController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [DatabaseController],
}).compile();
controller = module.get<DatabaseController>(DatabaseController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@ -0,0 +1,4 @@
import { Controller } from '@nestjs/common';
@Controller('database')
export class DatabaseController {}

View File

@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { DatabaseController } from './database.controller';
import { DatabaseService } from './database.service';
@Module({
controllers: [DatabaseController],
providers: [DatabaseService],
})
export class DatabaseModule {}

View File

@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { DatabaseService } from './database.service';
describe('DatabaseService', () => {
let service: DatabaseService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [DatabaseService],
}).compile();
service = module.get<DatabaseService>(DatabaseService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

View File

@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class DatabaseService {}

37
monorepo/migrations.json Normal file
View File

@ -0,0 +1,37 @@
{
"migrations": [
{
"cli": "nx",
"version": "19.1.0-beta.6",
"description": "Migrate no-extra-semi rules into user config, out of nx extendable configs",
"implementation": "./src/migrations/update-19-1-0-migrate-no-extra-semi/migrate-no-extra-semi",
"package": "@nx/eslint-plugin",
"name": "update-19-1-0-rename-no-extra-semi"
},
{
"cli": "nx",
"version": "19.1.0-beta.2",
"requires": {
"@angular/core": ">=18.0.0"
},
"description": "Update the @angular/cli package version to ~18.0.0.",
"factory": "./src/migrations/update-19-1-0/update-angular-cli",
"package": "@nx/angular",
"name": "update-angular-cli-version-18-0-0"
},
{
"version": "18.0.0",
"description": "Updates two-way bindings that have an invalid expression to use the longform expression instead.",
"factory": "./migrations/invalid-two-way-bindings/bundle",
"package": "@angular/core",
"name": "invalid-two-way-bindings"
},
{
"version": "18.0.0",
"description": "Replace deprecated HTTP related modules with provider functions",
"factory": "./migrations/http-providers/bundle",
"package": "@angular/core",
"name": "migration-http-providers"
}
]
}

View File

@ -1,10 +1,7 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default",
"!{projectRoot}/.eslintrc.json",
@ -37,28 +34,17 @@
"options": {
"targetName": "test"
},
"exclude": [
"apps/my-workspace-e2e/**/*",
"apps/my-nest-app-e2e/**/*"
]
"exclude": ["apps/my-workspace-e2e/**/*", "apps/my-nest-app-e2e/**/*"]
}
],
"targetDefaults": {
"@angular-devkit/build-angular:browser": {
"cache": true,
"dependsOn": [
"^build"
],
"inputs": [
"production",
"^production"
]
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"build": {
"inputs": [
"production",
"^production"
]
"inputs": ["production", "^production"]
}
},
"generators": {
@ -68,5 +54,6 @@
"style": "scss",
"unitTestRunner": "jest"
}
}
},
"nxCloudAccessToken": "YzgzODI0YjQtOTZlNi00NjRhLTk5ODEtNmQ1NTAwZmY3YWU2fHJlYWQtd3JpdGU="
}

View File

@ -5,18 +5,18 @@
"scripts": {},
"private": true,
"dependencies": {
"@angular/animations": "~17.3.0",
"@angular/common": "~17.3.0",
"@angular/compiler": "~17.3.0",
"@angular/core": "~17.3.0",
"@angular/forms": "~17.3.0",
"@angular/platform-browser": "~17.3.0",
"@angular/platform-browser-dynamic": "~17.3.0",
"@angular/router": "~17.3.0",
"@angular/animations": "18.0.1",
"@angular/common": "18.0.1",
"@angular/compiler": "18.0.1",
"@angular/core": "18.0.1",
"@angular/forms": "18.0.1",
"@angular/platform-browser": "18.0.1",
"@angular/platform-browser-dynamic": "18.0.1",
"@angular/router": "18.0.1",
"@nestjs/common": "^10.3.8",
"@nestjs/core": "^10.3.8",
"@nestjs/platform-express": "^10.3.8",
"@nrwl/workspace": "^19.0.4",
"@nrwl/workspace": "19.1.1",
"@prisma/client": "^5.14.0",
"axios": "^1.6.0",
"prisma": "^5.14.0",
@ -26,28 +26,28 @@
"zone.js": "~0.14.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~17.3.0",
"@angular-devkit/core": "~17.3.0",
"@angular-devkit/schematics": "~17.3.0",
"@angular-devkit/build-angular": "18.0.2",
"@angular-devkit/core": "18.0.2",
"@angular-devkit/schematics": "18.0.2",
"@angular-eslint/eslint-plugin": "~17.3.0",
"@angular-eslint/eslint-plugin-template": "~17.3.0",
"@angular-eslint/template-parser": "~17.3.0",
"@angular/cli": "~17.3.0",
"@angular/compiler-cli": "~17.3.0",
"@angular/language-service": "~17.3.0",
"@angular/compiler-cli": "18.0.1",
"@angular/language-service": "18.0.1",
"@nestjs/schematics": "^10.0.1",
"@nestjs/testing": "^10.0.2",
"@nx/angular": "^18.3.4",
"@nx/eslint": "18.3.4",
"@nx/eslint-plugin": "18.3.4",
"@nx/jest": "18.3.4",
"@nx/js": "18.3.4",
"@nx/nest": "18.3.4",
"@nx/node": "18.3.4",
"@nx/web": "18.3.4",
"@nx/webpack": "18.3.4",
"@nx/workspace": "18.3.4",
"@schematics/angular": "~17.3.0",
"@nx/angular": "19.1.1",
"@nx/eslint": "19.1.1",
"@nx/eslint-plugin": "19.1.1",
"@nx/jest": "19.1.1",
"@nx/js": "19.1.1",
"@nx/nest": "19.1.1",
"@nx/node": "19.1.1",
"@nx/web": "19.1.1",
"@nx/webpack": "19.1.1",
"@nx/workspace": "19.1.1",
"@schematics/angular": "18.0.2",
"@swc-node/register": "~1.8.0",
"@swc/core": "~1.3.85",
"@swc/helpers": "~0.5.2",
@ -60,8 +60,8 @@
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest-environment-node": "^29.4.1",
"jest-preset-angular": "~14.0.3",
"nx": "18.3.4",
"jest-preset-angular": "14.1.0",
"nx": "19.1.1",
"prettier": "^2.6.2",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",

File diff suppressed because it is too large Load Diff