Compare commits

...

3 commits

Author SHA1 Message Date
07039f2266 Nix: build from main, add metadata 2025-01-31 13:04:36 +01:00
981e70a743 Install class-validator and class-transformer 2025-01-31 12:44:53 +01:00
defbf2cdbe Run linter 2025-01-31 12:34:57 +01:00
6 changed files with 55 additions and 9 deletions

40
package-lock.json generated
View file

@ -14,6 +14,8 @@
"@nestjs/core": "^10.0.0",
"@nestjs/mongoose": "^11.0.0",
"@nestjs/platform-express": "^10.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"joi": "^17.13.3",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
@ -2254,6 +2256,12 @@
"@types/superagent": "^8.1.0"
}
},
"node_modules/@types/validator": {
"version": "13.12.2",
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.2.tgz",
"integrity": "sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==",
"license": "MIT"
},
"node_modules/@types/webidl-conversions": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
@ -3458,6 +3466,23 @@
"dev": true,
"license": "MIT"
},
"node_modules/class-transformer": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz",
"integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==",
"license": "MIT"
},
"node_modules/class-validator": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.1.tgz",
"integrity": "sha512-2VEG9JICxIqTpoK1eMzZqaV+u/EiwEJkMGzTrZf6sU/fwsnOITVgYJ8yojSy6CaXtO9V0Cc6ZQZ8h8m4UBuLwQ==",
"license": "MIT",
"dependencies": {
"@types/validator": "^13.11.8",
"libphonenumber-js": "^1.10.53",
"validator": "^13.9.0"
}
},
"node_modules/cli-cursor": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
@ -6556,6 +6581,12 @@
"node": ">= 0.8.0"
}
},
"node_modules/libphonenumber-js": {
"version": "1.11.19",
"resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.19.tgz",
"integrity": "sha512-bW/Yp/9dod6fmyR+XqSUL1N5JE7QRxQ3KrBIbYS1FTv32e5i3SEtQVX+71CYNv8maWNSOgnlCoNp9X78f/cKiA==",
"license": "MIT"
},
"node_modules/lines-and-columns": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
@ -9259,6 +9290,15 @@
"node": ">=10.12.0"
}
},
"node_modules/validator": {
"version": "13.12.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-13.12.0.tgz",
"integrity": "sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==",
"license": "MIT",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",

View file

@ -25,6 +25,8 @@
"@nestjs/core": "^10.0.0",
"@nestjs/mongoose": "^11.0.0",
"@nestjs/platform-express": "^10.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"joi": "^17.13.3",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"

View file

@ -7,12 +7,9 @@ buildNpmPackage {
name = "shows-api";
version = "1.0";
src = builtins.fetchGit {
url = "https://git.everest.tailscale/Toast/shows-api";
rev = "82e1a6258fc7704395233c23c79050204dbd1992";
};
src = ./.;
npmDepsHash = "sha256-iNib7GPvbpTexhRsq24TXoW0jlIox1IcA3wmE0BQcJM=";
npmDepsHash = "sha256-+nEblj18nt4tU4xAT+p/Dpv2RjYF36K8eZPgPCL7EMg=";
installPhase = ''
runHook preInstall
@ -27,4 +24,11 @@ buildNpmPackage {
--add-flags $out/dist/main --chdir $out \
--set NODE_ENV production
'';
meta = {
description = "NestJS API to store info about shows on a MongoDB database";
homepage = "https://git.everest.tailscale/Toast/shows-api";
sourceProvenance = lib.sourceTypes.fromSource;
mainProgram = "shows-api";
};
}

View file

@ -6,12 +6,12 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule);
const logger = new Logger('bootstrap');
let origin = ['https://shows.everest.tailscale/admin/'];
const origin = ['https://shows.everest.tailscale/admin/'];
if (process.env.NODE_ENV == 'production') {
logger.log('In production mode');
} else {
logger.log('In development mode');
origin.push("http://localhost:4200")
origin.push('http://localhost:4200');
}
app.enableCors({
credentials: true,

View file

@ -25,7 +25,7 @@ export class ShowsController {
return {
status: 'Ok',
message: 'Show was created successfully',
newId: newShow._id
newId: newShow._id,
};
} catch (error) {
throw new BadRequestException({