feat: add user data service

feature/auth
Artem-Darius Weber 2 years ago
parent 3e1f7f11e0
commit a1bd6ff939

@ -0,0 +1,10 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}

@ -0,0 +1,19 @@
/* eslint-disable */
export default {
displayName: 'auth-e2e',
preset: '../../jest.preset.js',
globalSetup: '<rootDir>/src/support/global-setup.ts',
globalTeardown: '<rootDir>/src/support/global-teardown.ts',
setupFiles: ['<rootDir>/src/support/test-setup.ts'],
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/auth-e2e',
};

@ -0,0 +1,22 @@
{
"name": "auth-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"implicitDependencies": ["auth"],
"targets": {
"e2e": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"],
"options": {
"jestConfig": "apps/auth-e2e/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/auth-e2e/**/*.{js,ts}"]
}
}
}
}

@ -0,0 +1,10 @@
import axios from 'axios';
describe('GET /api', () => {
it('should return a message', async () => {
const res = await axios.get(`/api`);
expect(res.status).toBe(200);
expect(res.data).toEqual({ message: 'Hello API' });
});
});

@ -0,0 +1,10 @@
/* eslint-disable */
var __TEARDOWN_MESSAGE__: string;
module.exports = async function () {
// Start services that that the app needs to run (e.g. database, docker-compose, etc.).
console.log('\nSetting up...\n');
// Hint: Use `globalThis` to pass variables to global teardown.
globalThis.__TEARDOWN_MESSAGE__ = '\nTearing down...\n';
};

@ -0,0 +1,7 @@
/* eslint-disable */
module.exports = async function () {
// Put clean up logic here (e.g. stopping services, docker-compose, etc.).
// Hint: `globalThis` is shared between setup and teardown.
console.log(globalThis.__TEARDOWN_MESSAGE__);
};

@ -0,0 +1,10 @@
/* eslint-disable */
import axios from 'axios';
module.exports = async function () {
// Configure axios for tests to use.
const host = process.env.HOST ?? 'localhost';
const port = process.env.PORT ?? '3000';
axios.defaults.baseURL = `http://${host}:${port}`;
};

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"esModuleInterop": true
}
}

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "src/**/*.ts"]
}

@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'auth',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/auth',
};

@ -0,0 +1,64 @@
{
"name": "auth",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/auth/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"target": "node",
"compiler": "tsc",
"outputPath": "dist/apps/auth",
"main": "apps/auth/src/main.ts",
"tsConfig": "apps/auth/tsconfig.app.json",
"assets": ["apps/auth/src/assets"],
"isolatedConfig": true,
"webpackConfig": "apps/auth/webpack.config.js"
},
"configurations": {
"development": {},
"production": {}
}
},
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "auth:build"
},
"configurations": {
"development": {
"buildTarget": "auth:build:development"
},
"production": {
"buildTarget": "auth:build:production"
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/auth/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/auth/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}

@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AppController } from './app.controller';
import { AppService } from './app.service';
describe('AppController', () => {
let app: TestingModule;
beforeAll(async () => {
app = await Test.createTestingModule({
controllers: [AppController],
providers: [AppService],
}).compile();
});
describe('getData', () => {
it('should return "Hello API"', () => {
const appController = app.get<AppController>(AppController);
expect(appController.getData()).toEqual({ message: 'Hello API' });
});
});
});

@ -0,0 +1,13 @@
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getData() {
return this.appService.getData();
}
}

@ -0,0 +1,11 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
@Module({
imports: [],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}

@ -0,0 +1,21 @@
import { Test } from '@nestjs/testing';
import { AppService } from './app.service';
describe('AppService', () => {
let service: AppService;
beforeAll(async () => {
const app = await Test.createTestingModule({
providers: [AppService],
}).compile();
service = app.get<AppService>(AppService);
});
describe('getData', () => {
it('should return "Hello API"', () => {
expect(service.getData()).toEqual({ message: 'Hello API' });
});
});
});

@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getData(): { message: string } {
return { message: 'Hello API' };
}
}

@ -0,0 +1,22 @@
/**
* This is not a production server yet!
* This is only a minimal backend to get started.
*/
import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app/app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const globalPrefix = 'api';
app.setGlobalPrefix(globalPrefix);
const port = process.env.PORT || 3000;
await app.listen(port);
Logger.log(
`🚀 Application is running on: http://localhost:${port}/${globalPrefix}`
);
}
bootstrap();

@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["node"],
"emitDecoratorMetadata": true,
"target": "es2021"
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}

@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"esModuleInterop": true
}
}

@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

@ -0,0 +1,8 @@
const { composePlugins, withNx } = require('@nx/webpack');
// Nx plugins for webpack.
module.exports = composePlugins(withNx(), (config) => {
// Update the webpack config as needed here.
// e.g. `config.plugins.push(new MyPlugin())`
return config;
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

@ -0,0 +1,10 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}

@ -0,0 +1,19 @@
/* eslint-disable */
export default {
displayName: 'user-data-e2e',
preset: '../../jest.preset.js',
globalSetup: '<rootDir>/src/support/global-setup.ts',
globalTeardown: '<rootDir>/src/support/global-teardown.ts',
setupFiles: ['<rootDir>/src/support/test-setup.ts'],
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/user-data-e2e',
};

@ -0,0 +1,22 @@
{
"name": "user-data-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"implicitDependencies": ["user-data"],
"targets": {
"e2e": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"],
"options": {
"jestConfig": "apps/user-data-e2e/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/user-data-e2e/**/*.{js,ts}"]
}
}
}
}

@ -0,0 +1,10 @@
/* eslint-disable */
var __TEARDOWN_MESSAGE__: string;
module.exports = async function () {
// Start services that that the app needs to run (e.g. database, docker-compose, etc.).
console.log('\nSetting up...\n');
// Hint: Use `globalThis` to pass variables to global teardown.
globalThis.__TEARDOWN_MESSAGE__ = '\nTearing down...\n';
};

@ -0,0 +1,7 @@
/* eslint-disable */
module.exports = async function () {
// Put clean up logic here (e.g. stopping services, docker-compose, etc.).
// Hint: `globalThis` is shared between setup and teardown.
console.log(globalThis.__TEARDOWN_MESSAGE__);
};

@ -0,0 +1,10 @@
/* eslint-disable */
import axios from 'axios';
module.exports = async function () {
// Configure axios for tests to use.
const host = process.env.HOST ?? 'localhost';
const port = process.env.PORT ?? '3000';
axios.defaults.baseURL = `http://${host}:${port}`;
};

@ -0,0 +1,10 @@
import axios from 'axios';
describe('GET /api', () => {
it('should return a message', async () => {
const res = await axios.get(`/api`);
expect(res.status).toBe(200);
expect(res.data).toEqual({ message: 'Hello API' });
});
});

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"esModuleInterop": true
}
}

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "src/**/*.ts"]
}

@ -0,0 +1,13 @@
$$
@version: 0.1.0;
@scuuid: 27895030-15ec-11ee-be56-0242ac120002;
@type: service;
@platform: nestjs;
@license: BSD-3-Clause;
@owner: artem-darius weber;
@author: ;
@title: user-data;
@desc: ;
@rp: kubsu it lab;
@vr: 7093;
$$

@ -0,0 +1,8 @@
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
DATABASE_URL=postgresql://postgres:postgres@sc-user-data-database/sc-user-data
PORT=3002

@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

@ -0,0 +1,3 @@
node_modules
# Keep environment variables out of version control
.env

@ -0,0 +1,32 @@
# syntax=docker/dockerfile:1
FROM node:18
WORKDIR /app
COPY --chown=node:node . .
RUN rm -f *.env *.env.*
RUN apt-get update -y && apt-get install -y dumb-init
RUN npm install
ENV NODE_ENV=production
RUN npm run prefullbuild && npm run prebuild && npm run build
RUN mkdir temp temp/.prisma temp/@prisma temp/prisma && cp -r ./node_modules/.prisma/* ./temp/.prisma/ && cp -r ./node_modules/@prisma/* ./temp/@prisma/ && cp -r ./node_modules/prisma/* ./temp/prisma/
RUN rm -rdf node_modules
RUN npm install --production
RUN cp -r ./temp/* ./node_modules/ && rm -rdf temp
RUN ls | grep -v node_modules | grep -v dist | xargs rm -rfv
RUN cp -r ./dist/* ./ && rm -rdf dist
USER node
CMD ["dumb-init", "node", "./main.js"]

@ -0,0 +1,11 @@
Copyright 2023 SC (DJEEFT) ©
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'user-data',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/user-data',
};

@ -0,0 +1,53 @@
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
uuid String @id @default(uuid()) @db.Uuid
email Email? @relation("mainEmail")
phoneNumber PhoneNumber? @relation("mainPhoneNumber")
reserveEmails Email[] @relation("reserveEmails")
reservePhoneNumbers PhoneNumber[] @relation("reservePhoneNumbers")
extendedData Json @default("{}") @db.JsonB
createdAt DateTime @db.Timestamp(3)
updatedAt DateTime @db.Timestamp(3)
}
model Email {
uuid String @id @default(uuid()) @db.Uuid
email String @unique @db.VarChar(256)
userUuid String? @unique @db.Uuid
user User? @relation("mainEmail", fields: [userUuid], references: [uuid])
userUuidReserve String? @db.Uuid
userReserve User? @relation("reserveEmails", fields: [userUuidReserve], references: [uuid])
createdAt DateTime @db.Timestamp(3)
updatedAt DateTime @db.Timestamp(3)
}
model PhoneNumber {
uuid String @id @default(uuid()) @db.Uuid
phoneNumber String @unique @db.VarChar(20)
userUuid String? @unique @db.Uuid
user User? @relation("mainPhoneNumber", fields: [userUuid], references: [uuid])
userUuidReserve String? @db.Uuid
userReserve User? @relation("reservePhoneNumbers", fields: [userUuidReserve], references: [uuid])
createdAt DateTime @db.Timestamp(3)
updatedAt DateTime @db.Timestamp(3)
}

@ -0,0 +1,64 @@
{
"name": "user-data",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/user-data/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"target": "node",
"compiler": "tsc",
"outputPath": "dist/apps/user-data",
"main": "apps/user-data/src/main.ts",
"tsConfig": "apps/user-data/tsconfig.app.json",
"assets": ["apps/user-data/src/assets"],
"isolatedConfig": true,
"webpackConfig": "apps/user-data/webpack.config.js"
},
"configurations": {
"development": {},
"production": {}
}
},
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "user-data:build"
},
"configurations": {
"development": {
"buildTarget": "user-data:build:development"
},
"production": {
"buildTarget": "user-data:build:production"
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/user-data/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/user-data/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}

@ -0,0 +1,225 @@
*.env
.idea
### NotepadPP template
# Notepad++ backups #
*.bak
### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Xcode template
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
## Gcc Patch
/*.gcno
### Linux template
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Kate template
# Swap Files #
.*.kate-swp
.swp.*
### Windows template
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### macOS template
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### SublimeText template
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# Workspace files are user-specific
*.sublime-workspace
# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project
# SFTP configuration file
sftp-config.json
sftp-config-alt*.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings

@ -0,0 +1,3 @@
POSTGRES_DB=sc-user-data
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres

@ -0,0 +1,34 @@
version: "3.9"
services:
user-data-database:
image: postgres:latest
container_name: user-data-database
restart: always
networks:
- user-data
volumes:
- user-data-database:/var/lib/postgresql
env_file:
- ./database.env
user-data-database-admin:
container_name: user-data-database-admin
image: bitnami/phppgadmin:latest
restart: always
networks:
- user-data
depends_on:
- user-data-database
environment:
- DATABASE_HOST=user-data-database
ports:
- "8083:8080"
networks:
user-data:
name: user-data
driver: bridge
volumes:
user-data-database:
driver: local

@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AppController } from './app.controller';
import { AppService } from './service/app.service';
describe('AppController', () => {
let app: TestingModule;
beforeAll(async () => {
app = await Test.createTestingModule({
controllers: [AppController],
providers: [AppService],
}).compile();
});
describe('getData', () => {
it('should return "Hello API"', () => {
const appController = app.get<AppController>(AppController);
expect(appController.getData()).toEqual({ message: 'Hello API' });
});
});
});

@ -0,0 +1,13 @@
import { Controller, Get } from '@nestjs/common';
import { AppService } from './service/app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getData() {
return this.appService.getData();
}
}

@ -0,0 +1,14 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './service/app.service';
import { UserModule } from "../user/user.module";
import { EmailModule } from "../email/email.module";
import { PhoneNumberModule } from "../phone-number/phone-number.module";
@Module({
imports: [UserModule, EmailModule, PhoneNumberModule],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}

@ -0,0 +1,21 @@
import { Test } from '@nestjs/testing';
import { AppService } from './app.service';
describe('AppService', () => {
let service: AppService;
beforeAll(async () => {
const app = await Test.createTestingModule({
providers: [AppService],
}).compile();
service = app.get<AppService>(AppService);
});
describe('getData', () => {
it('should return "Hello API"', () => {
expect(service.getData()).toEqual({ message: 'Hello API' });
});
});
});

@ -0,0 +1,8 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getData(): { message: string } {
return { message: 'Hello API' };
}
}

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

@ -0,0 +1,53 @@
import { Body, Controller, HttpCode, Inject, Post, UseInterceptors } from "@nestjs/common";
import { Prisma, Email } from "@prisma/client";
import { EmailService } from "./service/email.service";
import { PrismaErrorInterceptor } from "../prisma/interceptor/prisma-error.interceptor";
@Controller("email")
@UseInterceptors(PrismaErrorInterceptor)
export class EmailController {
constructor(@Inject(EmailService) private email: EmailService) {
}
@Post("find/unique")
@HttpCode(200)
async FindUnique(@Body() emailFindUniqueArgs: Prisma.EmailFindUniqueArgs): Promise<Partial<Email> | null> {
return await this.email.FindUnique(emailFindUniqueArgs);
}
@Post("find/first")
@HttpCode(200)
async FindFirst(@Body() emailFindFirstArgs: Prisma.EmailFindFirstArgs): Promise<Partial<Email> | null> {
return await this.email.FindFirst(emailFindFirstArgs);
}
@Post("find/many")
@HttpCode(200)
async FindMany(@Body() emailFindManyArgs: Prisma.EmailFindManyArgs): Promise<Partial<Email>[]> {
return await this.email.FindMany(emailFindManyArgs);
}
@Post("update")
@HttpCode(200)
async Update(@Body() emailUpdateArgs: Prisma.EmailUpdateArgs): Promise<Partial<Email>> {
return await this.email.Update(emailUpdateArgs);
}
@Post("count")
@HttpCode(200)
async Count(@Body() emailCountArgs: Prisma.EmailCountArgs): Promise<number> {
return await this.email.Count(emailCountArgs);
}
@Post("create")
@HttpCode(200)
async Create(@Body() emailCreateArgs: Prisma.EmailCreateArgs): Promise<Partial<Email>> {
return await this.email.Create(emailCreateArgs);
}
@Post("delete")
@HttpCode(200)
async Delete(@Body() emailDeleteArgs: Prisma.EmailDeleteArgs): Promise<Partial<Email>> {
return await this.email.Delete(emailDeleteArgs);
}
}

@ -0,0 +1,12 @@
import { Module } from "@nestjs/common";
import { EmailController } from "./email.controller";
import { EmailService } from "./service/email.service";
import { PrismaModule } from "../prisma/prisma.module";
@Module({
imports: [PrismaModule],
controllers: [EmailController],
providers: [EmailService]
})
export class EmailModule {
}

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

@ -0,0 +1,62 @@
import { Inject, Injectable } from "@nestjs/common";
import { PrismaService } from '../../prisma/service/prisma.service';
import { Email, Prisma } from "@prisma/client";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { UniqueConstraintFailedError } from "../../prisma/error/unique-constraint-failed.error";
import { RecordNotFoundError } from "../../prisma/error/record-not-found.error";
@Injectable()
export class EmailService {
constructor(@Inject(PrismaService) private prisma: PrismaService) {
}
async FindUnique(emailFindUniqueArgs: Prisma.EmailFindUniqueArgs): Promise<Partial<Email> | null> {
return await this.prisma.email.findUnique(emailFindUniqueArgs);
}
async FindFirst(emailFindFirstArgs: Prisma.EmailFindFirstArgs): Promise<Partial<Email> | null> {
return await this.prisma.email.findFirst(emailFindFirstArgs);
}
async FindMany(emailFindManyArgs: Prisma.EmailFindManyArgs): Promise<Partial<Email>[]> {
return await this.prisma.email.findMany(emailFindManyArgs);
}
async Update(emailUpdateArgs: Prisma.EmailUpdateArgs): Promise<Partial<Email>> {
try {
return await this.prisma.email.update(emailUpdateArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2025") throw new RecordNotFoundError("Record to update not found.");
if (e.code === "P2002") throw new UniqueConstraintFailedError("Unique constant failed");
}
throw e;
}
}
async Count(emailCountArgs: Prisma.EmailCountArgs): Promise<number> {
return await this.prisma.email.count(emailCountArgs);
}
async Create(emailCreateArgs: Prisma.EmailCreateArgs): Promise<Partial<Email>> {
try {
return await this.prisma.email.create(emailCreateArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2002") throw new UniqueConstraintFailedError("Unique constant failed");
}
throw e;
}
}
async Delete(emailDeleteArgs: Prisma.EmailDeleteArgs): Promise<Partial<Email>> {
try {
return await this.prisma.email.delete(emailDeleteArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2025") throw new RecordNotFoundError("Record to delete not found.");
}
throw e;
}
}
}

@ -0,0 +1,22 @@
/**
* This is not a production server yet!
* This is only a minimal backend to get started.
*/
import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app/app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const globalPrefix = 'api';
app.setGlobalPrefix(globalPrefix);
const port = process.env.PORT || 3002;
await app.listen(port);
Logger.log(
`🚀 User Data Application is running on: http://localhost:${port}/${globalPrefix}`
);
}
bootstrap();

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

@ -0,0 +1,53 @@
import { Body, Controller, HttpCode, Inject, Post, UseInterceptors } from "@nestjs/common";
import { PhoneNumber, Prisma } from "@prisma/client";
import { PhoneNumberService } from "./service/phone-number.service";
import { PrismaErrorInterceptor } from "../prisma/interceptor/prisma-error.interceptor";
@Controller("phoneNumber")
@UseInterceptors(PrismaErrorInterceptor)
export class PhoneNumberController {
constructor(@Inject(PhoneNumberService) private phoneNumber: PhoneNumberService) {
}
@Post("find/unique")
@HttpCode(200)
async FindUnique(@Body() phoneNumberFindUniqueArgs: Prisma.PhoneNumberFindUniqueArgs): Promise<Partial<PhoneNumber> | null> {
return await this.phoneNumber.FindUnique(phoneNumberFindUniqueArgs);
}
@Post("find/first")
@HttpCode(200)
async FindFirst(@Body() phoneNumberFindFirstArgs: Prisma.PhoneNumberFindFirstArgs): Promise<Partial<PhoneNumber> | null> {
return await this.phoneNumber.FindFirst(phoneNumberFindFirstArgs);
}
@Post("find/many")
@HttpCode(200)
async FindMany(@Body() phoneNumberFindManyArgs: Prisma.PhoneNumberFindManyArgs): Promise<Partial<PhoneNumber>[]> {
return await this.phoneNumber.FindMany(phoneNumberFindManyArgs);
}
@Post("update")
@HttpCode(200)
async Update(@Body() phoneNumberUpdateArgs: Prisma.PhoneNumberUpdateArgs): Promise<Partial<PhoneNumber>> {
return await this.phoneNumber.Update(phoneNumberUpdateArgs);
}
@Post("count")
@HttpCode(200)
async Count(@Body() phoneNumberCountArgs: Prisma.PhoneNumberCountArgs): Promise<number> {
return await this.phoneNumber.Count(phoneNumberCountArgs);
}
@Post("create")
@HttpCode(200)
async Create(@Body() phoneNumberCreateArgs: Prisma.PhoneNumberCreateArgs): Promise<Partial<PhoneNumber>> {
return await this.phoneNumber.Create(phoneNumberCreateArgs);
}
@Post("delete")
@HttpCode(200)
async Delete(@Body() phoneNumberDeleteArgs: Prisma.PhoneNumberDeleteArgs): Promise<Partial<PhoneNumber>> {
return await this.phoneNumber.Delete(phoneNumberDeleteArgs);
}
}

@ -0,0 +1,12 @@
import { Module } from "@nestjs/common";
import { PhoneNumberController } from "./phone-number.controller";
import { PhoneNumberService } from "./service/phone-number.service";
import { PrismaModule } from "../prisma/prisma.module";
@Module({
imports: [PrismaModule],
controllers: [PhoneNumberController],
providers: [PhoneNumberService]
})
export class PhoneNumberModule {
}

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

@ -0,0 +1,62 @@
import { Inject, Injectable } from "@nestjs/common";
import { PrismaService } from "../../prisma/service/prisma.service";
import { PhoneNumber, Prisma } from "@prisma/client";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { UniqueConstraintFailedError } from "../../prisma/error/unique-constraint-failed.error";
import { RecordNotFoundError } from "../../prisma/error/record-not-found.error";
@Injectable()
export class PhoneNumberService {
constructor(@Inject(PrismaService) private prisma: PrismaService) {
}
async FindUnique(phoneNumberFindUniqueArgs: Prisma.PhoneNumberFindUniqueArgs): Promise<Partial<PhoneNumber> | null> {
return await this.prisma.phoneNumber.findUnique(phoneNumberFindUniqueArgs);
}
async FindFirst(phoneNumberFindFirstArgs: Prisma.PhoneNumberFindFirstArgs): Promise<Partial<PhoneNumber> | null> {
return await this.prisma.phoneNumber.findFirst(phoneNumberFindFirstArgs);
}
async FindMany(phoneNumberFindManyArgs: Prisma.PhoneNumberFindManyArgs): Promise<Partial<PhoneNumber>[]> {
return await this.prisma.phoneNumber.findMany(phoneNumberFindManyArgs);
}
async Update(phoneNumberUpdateArgs: Prisma.PhoneNumberUpdateArgs): Promise<Partial<PhoneNumber>> {
try {
return await this.prisma.phoneNumber.update(phoneNumberUpdateArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2025") throw new RecordNotFoundError("Record to update not found.");
if (e.code === "P2002") throw new UniqueConstraintFailedError("Unique constant failed");
}
throw e;
}
}
async Count(phoneNumberCountArgs: Prisma.PhoneNumberCountArgs): Promise<number> {
return await this.prisma.phoneNumber.count(phoneNumberCountArgs);
}
async Create(phoneNumberCreateArgs: Prisma.PhoneNumberCreateArgs): Promise<Partial<PhoneNumber>> {
try {
return await this.prisma.phoneNumber.create(phoneNumberCreateArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2002") throw new UniqueConstraintFailedError("Unique constant failed");
}
throw e;
}
}
async Delete(phoneNumberDeleteArgs: Prisma.PhoneNumberDeleteArgs): Promise<Partial<PhoneNumber>> {
try {
return await this.prisma.phoneNumber.delete(phoneNumberDeleteArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2025") throw new RecordNotFoundError("Record to delete not found.");
}
throw e;
}
}
}

@ -0,0 +1 @@
export class RecordNotFoundError extends Error {}

@ -0,0 +1 @@
export class UniqueConstraintFailedError extends Error {}

@ -0,0 +1,26 @@
import {
CallHandler,
ConflictException,
ExecutionContext,
Injectable,
NestInterceptor,
NotFoundException
} from "@nestjs/common";
import { catchError, Observable } from "rxjs";
import { RecordNotFoundError } from "../error/record-not-found.error";
import { UniqueConstraintFailedError } from "../error/unique-constraint-failed.error";
@Injectable()
export class PrismaErrorInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
return next
.handle()
.pipe(
catchError(err => {
if (err instanceof RecordNotFoundError) throw new NotFoundException(err.message);
if (err instanceof UniqueConstraintFailedError) throw new ConflictException(err.message);
throw err;
})
);
}
}

@ -0,0 +1,10 @@
import { Global, Module } from "@nestjs/common";
import { PrismaService } from "./service/prisma.service";
@Global()
@Module({
providers: [PrismaService],
exports: [PrismaService]
})
export class PrismaModule {
}

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

@ -0,0 +1,15 @@
import { INestApplication, Injectable, OnModuleInit } from "@nestjs/common";
import { PrismaClient } from "@prisma/client";
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}
async enableShutdownHooks(app: INestApplication) {
this.$on("beforeExit", async () => {
await app.close();
});
}
}

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

@ -0,0 +1,62 @@
import { Inject, Injectable } from "@nestjs/common";
import { PrismaService } from "../../prisma/service/prisma.service";
import { Prisma, User } from "@prisma/client";
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import { UniqueConstraintFailedError } from "../../prisma/error/unique-constraint-failed.error";
import { RecordNotFoundError } from "../../prisma/error/record-not-found.error";
@Injectable()
export class UserService {
constructor(@Inject(PrismaService) private prisma: PrismaService) {
}
async FindUnique(userFindUniqueArgs: Prisma.UserFindUniqueArgs): Promise<Partial<User> | null> {
return await this.prisma.user.findUnique(userFindUniqueArgs);
}
async FindFirst(userFindFirstArgs: Prisma.UserFindFirstArgs): Promise<Partial<User> | null> {
return await this.prisma.user.findFirst(userFindFirstArgs);
}
async FindMany(userFindManyArgs: Prisma.UserFindManyArgs): Promise<Partial<User>[]> {
return await this.prisma.user.findMany(userFindManyArgs);
}
async Update(userUpdateArgs: Prisma.UserUpdateArgs): Promise<Partial<User>> {
try {
return await this.prisma.user.update(userUpdateArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2025") throw new RecordNotFoundError("Record to update not found.");
if (e.code === "P2002") throw new UniqueConstraintFailedError("Unique constant failed");
}
throw e;
}
}
async Count(userCountArgs: Prisma.UserCountArgs): Promise<number> {
return await this.prisma.user.count(userCountArgs);
}
async Create(userCreateArgs: Prisma.UserCreateArgs): Promise<Partial<User>> {
try {
return await this.prisma.user.create(userCreateArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2002") throw new UniqueConstraintFailedError("Unique constant failed");
}
throw e;
}
}
async Delete(userDeleteArgs: Prisma.UserDeleteArgs): Promise<Partial<User>> {
try {
return await this.prisma.user.delete(userDeleteArgs);
} catch (e) {
if (e instanceof PrismaClientKnownRequestError) {
if (e.code === "P2025") throw new RecordNotFoundError("Record to delete not found.");
}
throw e;
}
}
}

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

@ -0,0 +1,53 @@
import { Body, Controller, HttpCode, Inject, Post, UseInterceptors } from "@nestjs/common";
import { Prisma, User } from "@prisma/client";
import { UserService } from "./service/user.service";
import { PrismaErrorInterceptor } from "../prisma/interceptor/prisma-error.interceptor";
@Controller("user")
@UseInterceptors(PrismaErrorInterceptor)
export class UserController {
constructor(@Inject(UserService) private user: UserService) {
}
@Post("find/unique")
@HttpCode(200)
async FindUnique(@Body() userFindUniqueArgs: Prisma.UserFindUniqueArgs): Promise<Partial<User> | null> {
return await this.user.FindUnique(userFindUniqueArgs);
}
@Post("find/first")
@HttpCode(200)
async FindFirst(@Body() userFindFirstArgs: Prisma.UserFindFirstArgs): Promise<Partial<User> | null> {
return await this.user.FindFirst(userFindFirstArgs);
}
@Post("find/many")
@HttpCode(200)
async FindMany(@Body() userFindManyArgs: Prisma.UserFindManyArgs): Promise<Partial<User>[]> {
return await this.user.FindMany(userFindManyArgs);
}
@Post("update")
@HttpCode(200)
async Update(@Body() userUpdateArgs: Prisma.UserUpdateArgs): Promise<Partial<User>> {
return await this.user.Update(userUpdateArgs);
}
@Post("count")
@HttpCode(200)
async Count(@Body() userCountArgs: Prisma.UserCountArgs): Promise<number> {
return await this.user.Count(userCountArgs);
}
@Post("create")
@HttpCode(200)
async Create(@Body() userCreateArgs: Prisma.UserCreateArgs): Promise<Partial<User>> {
return await this.user.Create(userCreateArgs);
}
@Post("delete")
@HttpCode(200)
async Delete(@Body() userDeleteArgs: Prisma.UserDeleteArgs): Promise<Partial<User>> {
return await this.user.Delete(userDeleteArgs);
}
}

@ -0,0 +1,12 @@
import { Module } from "@nestjs/common";
import { UserController } from "./user.controller";
import { UserService } from "./service/user.service";
import { PrismaModule } from "../prisma/prisma.module";
@Module({
imports: [PrismaModule],
controllers: [UserController],
providers: [UserService]
})
export class UserModule {
}

@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["node"],
"emitDecoratorMetadata": true,
"target": "es2021"
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}

@ -0,0 +1,31 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"esModuleInterop": true
},
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"incremental": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"strictBindCallApply": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true
}

@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

@ -0,0 +1,8 @@
const { composePlugins, withNx } = require('@nx/webpack');
// Nx plugins for webpack.
module.exports = composePlugins(withNx(), (config) => {
// Update the webpack config as needed here.
// e.g. `config.plugins.push(new MyPlugin())`
return config;
});

@ -0,0 +1,47 @@
version: '3'
services:
zookeeper-log:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
ports:
- "2181:2181"
environment:
- ZOOKEEPER_CLIENT_PORT=2181
- ZOOKEEPER_TICK_TIME=2000
networks:
- dev-panels
- kafka-log
kafka-log:
image: confluentinc/cp-kafka:latest
container_name: kafka
ports:
- "9092:9092"
environment:
- KAFKA_BROKER_ID=1
- KAFKA_LISTENERS=PLAINTEXT://:9092
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
- KAFKA_ZOOKEEPER_CONNECT=zookeeper-log:2181
depends_on:
- zookeeper-log
networks:
- kafka-log
kafka-log-manager:
image: hlebalbau/kafka-manager:latest
container_name: kafka-manager
ports:
- "9000:9000"
environment:
- ZK_HOSTS=zookeeper:2181
depends_on:
- zookeeper-log
networks:
- kafka-log
networks:
dev-panels:
driver: bridge
kafka-log:
driver: bridge

51
package-lock.json generated

@ -16,6 +16,7 @@
"@nestjs/graphql": "^12.0.3", "@nestjs/graphql": "^12.0.3",
"@nestjs/platform-express": "^10.0.2", "@nestjs/platform-express": "^10.0.2",
"@nestjs/typeorm": "^10.0.0", "@nestjs/typeorm": "^10.0.0",
"@prisma/client": "^4.16.1",
"@swc/helpers": "~0.5.0", "@swc/helpers": "~0.5.0",
"axios": "^1.0.0", "axios": "^1.0.0",
"graphql": "^16.7.1", "graphql": "^16.7.1",
@ -66,6 +67,7 @@
"nx": "16.4.0", "nx": "16.4.0",
"nx-cloud": "latest", "nx-cloud": "latest",
"prettier": "^2.6.2", "prettier": "^2.6.2",
"prisma": "^4.16.1",
"react-refresh": "^0.10.0", "react-refresh": "^0.10.0",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.0",
"ts-node": "10.9.1", "ts-node": "10.9.1",
@ -4469,6 +4471,38 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@prisma/client": {
"version": "4.16.1",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.16.1.tgz",
"integrity": "sha512-CoDHu7Bt+NuDo40ijoeHP79EHtECsPBTy3yte5Yo3op8TqXt/kV0OT5OrsWewKvQGKFMHhYQ+ePed3zzjYdGAw==",
"hasInstallScript": true,
"dependencies": {
"@prisma/engines-version": "4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c"
},
"engines": {
"node": ">=14.17"
},
"peerDependencies": {
"prisma": "*"
},
"peerDependenciesMeta": {
"prisma": {
"optional": true
}
}
},
"node_modules/@prisma/engines": {
"version": "4.16.1",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.16.1.tgz",
"integrity": "sha512-gpZG0kGGxfemgvK/LghHdBIz+crHkZjzszja94xp4oytpsXrgt/Ice82MvPsWMleVIniKuARrowtsIsim0PFJQ==",
"devOptional": true,
"hasInstallScript": true
},
"node_modules/@prisma/engines-version": {
"version": "4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c.tgz",
"integrity": "sha512-tMWAF/qF00fbUH1HB4Yjmz6bjh7fzkb7Y3NRoUfMlHu6V+O45MGvqwYxqwBjn1BIUXkl3r04W351D4qdJjrgvA=="
},
"node_modules/@protobufjs/aspromise": { "node_modules/@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@ -15387,6 +15421,23 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/prisma": {
"version": "4.16.1",
"resolved": "https://registry.npmjs.org/prisma/-/prisma-4.16.1.tgz",
"integrity": "sha512-C2Xm7yxHxjFjjscBEW4tmoraPHH/Vyu/A0XABdbaFtoiOZARsxvOM7rwc2iZ0qVxbh0bGBGBWZUSXO/52/nHBQ==",
"devOptional": true,
"hasInstallScript": true,
"dependencies": {
"@prisma/engines": "4.16.1"
},
"bin": {
"prisma": "build/index.js",
"prisma2": "build/index.js"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/process-nextick-args": { "node_modules/process-nextick-args": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",

@ -12,6 +12,7 @@
"@nestjs/graphql": "^12.0.3", "@nestjs/graphql": "^12.0.3",
"@nestjs/platform-express": "^10.0.2", "@nestjs/platform-express": "^10.0.2",
"@nestjs/typeorm": "^10.0.0", "@nestjs/typeorm": "^10.0.0",
"@prisma/client": "^4.16.1",
"@swc/helpers": "~0.5.0", "@swc/helpers": "~0.5.0",
"axios": "^1.0.0", "axios": "^1.0.0",
"graphql": "^16.7.1", "graphql": "^16.7.1",
@ -62,6 +63,7 @@
"nx": "16.4.0", "nx": "16.4.0",
"nx-cloud": "latest", "nx-cloud": "latest",
"prettier": "^2.6.2", "prettier": "^2.6.2",
"prisma": "^4.16.1",
"react-refresh": "^0.10.0", "react-refresh": "^0.10.0",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.0",
"ts-node": "10.9.1", "ts-node": "10.9.1",

Loading…
Cancel
Save