tatayab-db 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/.prettierrc +4 -0
  2. package/.sequelizerc +6 -0
  3. package/README.md +98 -0
  4. package/eslint.config.mjs +35 -0
  5. package/libs/tatayab-entities-library/src/entities/apikey.entity.ts +33 -0
  6. package/libs/tatayab-entities-library/src/entities/area.entity.ts +24 -0
  7. package/libs/tatayab-entities-library/src/entities/country.entity.ts +15 -0
  8. package/libs/tatayab-entities-library/src/entities/sys.role.entity.ts +7 -0
  9. package/libs/tatayab-entities-library/src/entities/sys.user.entity.ts +49 -0
  10. package/libs/tatayab-entities-library/src/entities/translation.entity.ts +17 -0
  11. package/libs/tatayab-entities-library/src/entities/user.entity.ts +85 -0
  12. package/libs/tatayab-entities-library/src/index.ts +12 -0
  13. package/libs/tatayab-entities-library/src/utils/enums/gender.ts +5 -0
  14. package/libs/tatayab-entities-library/src/utils/enums/language.ts +4 -0
  15. package/libs/tatayab-entities-library/src/utils/enums/osName.ts +5 -0
  16. package/libs/tatayab-entities-library/src/utils/enums/productApp.ts +4 -0
  17. package/libs/tatayab-entities-library/src/utils/enums/status.ts +4 -0
  18. package/libs/tatayab-entities-library/src/utils/enums/versiontype.ts +4 -0
  19. package/libs/tatayab-entities-library/tsconfig.lib.json +9 -0
  20. package/nest-cli.json +18 -0
  21. package/package.json +79 -0
  22. package/src/app.module.ts +26 -0
  23. package/src/database/config.js +35 -0
  24. package/src/main.ts +8 -0
  25. package/test/app.e2e-spec.ts +25 -0
  26. package/test/jest-e2e.json +9 -0
  27. package/tsconfig.build.json +4 -0
  28. package/tsconfig.json +25 -0
package/.prettierrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
+ }
package/.sequelizerc ADDED
@@ -0,0 +1,6 @@
1
+ const path = require('path');
2
+ module.exports = {
3
+ 'seeders-path': path.resolve('src/database', 'seeders'),
4
+ 'migrations-path': path.resolve('src/database', 'migrations'),
5
+ 'config': path.resolve('src/database', 'config.js'),
6
+ }
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ <p align="center">
2
+ <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
3
+ </p>
4
+
5
+ [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6
+ [circleci-url]: https://circleci.com/gh/nestjs/nest
7
+
8
+ <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13
+ <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14
+ <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
15
+ <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
16
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
17
+ <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
18
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
19
+ <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
20
+ </p>
21
+ <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
22
+ [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
23
+
24
+ ## Description
25
+
26
+ [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
27
+
28
+ ## Project setup
29
+
30
+ ```bash
31
+ $ npm install
32
+ ```
33
+
34
+ ## Compile and run the project
35
+
36
+ ```bash
37
+ # development
38
+ $ npm run start
39
+
40
+ # watch mode
41
+ $ npm run start:dev
42
+
43
+ # production mode
44
+ $ npm run start:prod
45
+ ```
46
+
47
+ ## Run tests
48
+
49
+ ```bash
50
+ # unit tests
51
+ $ npm run test
52
+
53
+ # e2e tests
54
+ $ npm run test:e2e
55
+
56
+ # test coverage
57
+ $ npm run test:cov
58
+ ```
59
+
60
+ ## Deployment
61
+
62
+ When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
63
+
64
+ If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
65
+
66
+ ```bash
67
+ $ npm install -g @nestjs/mau
68
+ $ mau deploy
69
+ ```
70
+
71
+ With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
72
+
73
+ ## Resources
74
+
75
+ Check out a few resources that may come in handy when working with NestJS:
76
+
77
+ - Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
78
+ - For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
79
+ - To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
80
+ - Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
81
+ - Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
82
+ - Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
83
+ - To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
84
+ - Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
85
+
86
+ ## Support
87
+
88
+ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
89
+
90
+ ## Stay in touch
91
+
92
+ - Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
93
+ - Website - [https://nestjs.com](https://nestjs.com/)
94
+ - Twitter - [@nestframework](https://twitter.com/nestframework)
95
+
96
+ ## License
97
+
98
+ Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
@@ -0,0 +1,35 @@
1
+ // @ts-check
2
+ import eslint from '@eslint/js';
3
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4
+ import globals from 'globals';
5
+ import tseslint from 'typescript-eslint';
6
+
7
+ export default tseslint.config(
8
+ {
9
+ ignores: ['eslint.config.mjs'],
10
+ },
11
+ eslint.configs.recommended,
12
+ ...tseslint.configs.recommendedTypeChecked,
13
+ eslintPluginPrettierRecommended,
14
+ {
15
+ languageOptions: {
16
+ globals: {
17
+ ...globals.node,
18
+ ...globals.jest,
19
+ },
20
+ sourceType: 'commonjs',
21
+ parserOptions: {
22
+ projectService: true,
23
+ tsconfigRootDir: import.meta.dirname,
24
+ },
25
+ },
26
+ },
27
+ {
28
+ rules: {
29
+ '@typescript-eslint/no-explicit-any': 'off',
30
+ '@typescript-eslint/no-floating-promises': 'warn',
31
+ '@typescript-eslint/no-unsafe-argument': 'warn',
32
+ "prettier/prettier": ["error", { endOfLine: "auto" }],
33
+ },
34
+ },
35
+ );
@@ -0,0 +1,33 @@
1
+ import { Column, DataType, Model, Table } from 'sequelize-typescript';
2
+ import { Status } from '../utils/enums/status';
3
+ import { VersionType } from '../utils/enums/versiontype';
4
+ import { OsName } from '../utils/enums/osName';
5
+ import { ProductApp } from '../utils/enums/productApp';
6
+
7
+ @Table
8
+ class ApiKey extends Model {
9
+ @Column
10
+ hashedApiKey: string;
11
+ @Column({ type: DataType.ENUM(...Object.values(OsName)) })
12
+ system: OsName;
13
+ @Column({ type: DataType.ENUM(...Object.values(ProductApp)) })
14
+ appName: ProductApp;
15
+ @Column
16
+ appVersion: string;
17
+ @Column
18
+ expiryDate: Date;
19
+ @Column({
20
+ type: DataType.ENUM(...Object.values(Status)),
21
+ defaultValue: Status.ACTIVE,
22
+ })
23
+ status: Status;
24
+ @Column
25
+ isReleased: boolean;
26
+ @Column({
27
+ type: DataType.ENUM(...Object.values(VersionType)),
28
+ defaultValue: VersionType.OPTIONAL,
29
+ })
30
+ versionType: VersionType;
31
+ }
32
+
33
+ export default ApiKey;
@@ -0,0 +1,24 @@
1
+ import {
2
+ BelongsTo,
3
+ Column,
4
+ ForeignKey,
5
+ Model,
6
+ Table,
7
+ } from 'sequelize-typescript';
8
+ import { Country } from './country.entity';
9
+
10
+ @Table
11
+ export class Area extends Model {
12
+ @ForeignKey(() => Country)
13
+ @Column({
14
+ allowNull: false,
15
+ validate: { notNull: { msg: 'County Id Required' } },
16
+ })
17
+ countryId!: number;
18
+
19
+ @Column
20
+ parentId?: number;
21
+
22
+ @BelongsTo(() => Country)
23
+ country: Country;
24
+ }
@@ -0,0 +1,15 @@
1
+ import { Column, Model, Table } from 'sequelize-typescript';
2
+
3
+ @Table
4
+ export class Country extends Model {
5
+ @Column
6
+ flagIcon: string;
7
+ @Column
8
+ isoCode: string;
9
+ @Column
10
+ phoneExt: string;
11
+ @Column
12
+ currency: string;
13
+ @Column
14
+ exchangeRateToKwd: number;
15
+ }
@@ -0,0 +1,7 @@
1
+ import { Column, Model, Table } from 'sequelize-typescript';
2
+
3
+ @Table
4
+ export class SysRole extends Model {
5
+ @Column
6
+ name: string;
7
+ }
@@ -0,0 +1,49 @@
1
+ import {
2
+ BelongsTo,
3
+ Column,
4
+ DataType,
5
+ ForeignKey,
6
+ Model,
7
+ Table,
8
+ } from 'sequelize-typescript';
9
+ import { Status } from '../utils/enums/status';
10
+ import { SysRole } from './sys.role.entity';
11
+
12
+ @Table
13
+ export class SysUser extends Model {
14
+ @Column
15
+ name!: string;
16
+
17
+ @Column({ allowNull: false, validate: { unique: true } })
18
+ username!: string;
19
+
20
+ @Column
21
+ email!: string;
22
+
23
+ @Column
24
+ phoneExt!: string;
25
+
26
+ @Column
27
+ phone!: string;
28
+
29
+ @Column
30
+ password!: string;
31
+ @Column({
32
+ type: DataType.ENUM(...Object.values(Status)),
33
+ defaultValue: Status.ACTIVE,
34
+ })
35
+ status?: Status;
36
+
37
+ @ForeignKey(() => SysRole)
38
+ @Column
39
+ roleId: number;
40
+
41
+ @Column
42
+ profilePicture: string;
43
+
44
+ @Column
45
+ lastLogin: Date;
46
+
47
+ @BelongsTo(() => SysRole)
48
+ role: SysRole;
49
+ }
@@ -0,0 +1,17 @@
1
+ import { Column, Model, Table } from 'sequelize-typescript';
2
+
3
+ @Table
4
+ export class Translation extends Model {
5
+ @Column
6
+ text: string;
7
+ @Column
8
+ shortDesc?: string;
9
+ @Column
10
+ longDesc?: string;
11
+ @Column
12
+ locale: string;
13
+ @Column
14
+ entityId: string;
15
+ @Column
16
+ entityName: string;
17
+ }
@@ -0,0 +1,85 @@
1
+ import {
2
+ Model,
3
+ Table,
4
+ Column,
5
+ ForeignKey,
6
+ BelongsTo,
7
+ DataType,
8
+ } from 'sequelize-typescript';
9
+ import { Status } from '../utils/enums/status';
10
+ import { Language } from '../utils/enums/language';
11
+ import { Country } from './country.entity';
12
+ import { Gender } from '../utils/enums/gender';
13
+
14
+ @Table
15
+ export class User extends Model {
16
+ @Column
17
+ firstName?: string;
18
+
19
+ @Column
20
+ lastName?: string;
21
+
22
+ @Column
23
+ password!: string;
24
+
25
+ @Column({
26
+ type: DataType.ENUM(...Object.values(Status)),
27
+ defaultValue: Status.ACTIVE,
28
+ })
29
+ status: Status;
30
+
31
+ @Column({ allowNull: false, validate: { isEmail: { msg: 'Invalid Email' } } })
32
+ email!: string;
33
+
34
+ @Column
35
+ phone?: string;
36
+
37
+ @Column
38
+ phoneExt?: string;
39
+
40
+ @Column
41
+ birthday?: Date;
42
+
43
+ @Column
44
+ facebookId?: string;
45
+
46
+ @Column
47
+ googleId?: string;
48
+
49
+ @Column
50
+ appleId?: string;
51
+
52
+ @Column({
53
+ type: DataType.ENUM(...Object.values(Language)),
54
+ defaultValue: Language.ENGLISH,
55
+ })
56
+ preferredLanguage: Language;
57
+
58
+ @ForeignKey(() => Country)
59
+ @Column
60
+ preferredCountryId?: number;
61
+
62
+ @Column
63
+ profilePic?: string;
64
+
65
+ @Column
66
+ lastLogin!: Date;
67
+
68
+ @Column({ allowNull: false, defaultValue: false })
69
+ isBlocked!: boolean;
70
+
71
+ @Column({ defaultValue: false })
72
+ isVerified: boolean;
73
+
74
+ @Column
75
+ refCode: string;
76
+
77
+ @Column({
78
+ type: DataType.ENUM(...Object.values(Gender)),
79
+ defaultValue: Gender.PREFER_NOT_TO_SAY,
80
+ })
81
+ gender: Gender;
82
+
83
+ @BelongsTo(() => Country)
84
+ country: Country;
85
+ }
@@ -0,0 +1,12 @@
1
+ import { ModelCtor } from 'sequelize-typescript';
2
+ import { Country } from './entities/country.entity';
3
+ import { Translation } from './entities/translation.entity';
4
+ import ApiKey from './entities/apikey.entity';
5
+ import { Area } from './entities/area.entity';
6
+ import { SysRole } from './entities/sys.role.entity';
7
+ import { SysUser } from './entities/sys.user.entity';
8
+ import { User } from './entities/user.entity';
9
+
10
+ export function getDbModels(): ModelCtor[] {
11
+ return [ApiKey, Area, Country, SysRole, SysUser, Translation, User];
12
+ }
@@ -0,0 +1,5 @@
1
+ export enum Gender {
2
+ MALE = 'Male',
3
+ FEMALE = 'Female',
4
+ PREFER_NOT_TO_SAY = 'Prefer not to say',
5
+ }
@@ -0,0 +1,4 @@
1
+ export enum Language {
2
+ ENGLISH = 'en',
3
+ ARABIC = 'ar',
4
+ }
@@ -0,0 +1,5 @@
1
+ export enum OsName {
2
+ ANDROID = 'android',
3
+ IOS = 'iOS',
4
+ WEB = 'web',
5
+ }
@@ -0,0 +1,4 @@
1
+ export enum ProductApp {
2
+ DASHBOARD = 'dashboard',
3
+ USER_APP = 'userapp',
4
+ }
@@ -0,0 +1,4 @@
1
+ export enum Status {
2
+ ACTIVE = 'active',
3
+ IN_ACTIVE = 'inactive',
4
+ }
@@ -0,0 +1,4 @@
1
+ export enum VersionType {
2
+ OPTIONAL = 'optional',
3
+ MANDATORY = 'mandatory',
4
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "outDir": "../../dist/libs/trycar-entities-library"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
9
+ }
package/nest-cli.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "collection": "@nestjs/schematics",
3
+ "sourceRoot": "src",
4
+ "projects": {
5
+ "trycar-entities-library": {
6
+ "type": "library",
7
+ "root": "libs/trycar-entities-library",
8
+ "entryFile": "index",
9
+ "sourceRoot": "libs/trycar-entities-library/src",
10
+ "compilerOptions": {
11
+ "tsConfigPath": "libs/trycar-entities-library/tsconfig.lib.json"
12
+ }
13
+ }
14
+ },
15
+ "compilerOptions": {
16
+ "webpack": true
17
+ }
18
+ }
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "tatayab-db",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "author": "",
6
+ "private": false,
7
+ "license": "UNLICENSED",
8
+ "scripts": {
9
+ "build": "nest build",
10
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
11
+ "start": "nest start",
12
+ "start:dev": "nest start --watch",
13
+ "start:debug": "nest start --debug --watch",
14
+ "start:prod": "node dist/main",
15
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16
+ "test": "jest",
17
+ "test:watch": "jest --watch",
18
+ "test:cov": "jest --coverage",
19
+ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20
+ "test:e2e": "jest --config ./test/jest-e2e.json",
21
+ "publish-tt": "npm run build && npm publish"
22
+ },
23
+ "dependencies": {
24
+ "@nestjs/common": "^11.0.1",
25
+ "@nestjs/config": "^4.0.3",
26
+ "@nestjs/core": "^11.0.1",
27
+ "@nestjs/platform-express": "^11.0.1",
28
+ "@nestjs/sequelize": "^11.0.1",
29
+ "class-validator": "^0.15.1",
30
+ "mysql2": "^3.18.2",
31
+ "reflect-metadata": "^0.2.2",
32
+ "rxjs": "^7.8.1",
33
+ "sequelize": "^6.37.7",
34
+ "sequelize-typescript": "^2.1.6"
35
+ },
36
+ "devDependencies": {
37
+ "@eslint/eslintrc": "^3.2.0",
38
+ "@eslint/js": "^9.18.0",
39
+ "@nestjs/cli": "^11.0.0",
40
+ "@nestjs/schematics": "^11.0.0",
41
+ "@nestjs/testing": "^11.0.1",
42
+ "@types/express": "^5.0.0",
43
+ "@types/jest": "^30.0.0",
44
+ "@types/node": "^22.10.7",
45
+ "@types/sequelize": "^4.28.20",
46
+ "@types/supertest": "^6.0.2",
47
+ "eslint": "^9.18.0",
48
+ "eslint-config-prettier": "^10.0.1",
49
+ "eslint-plugin-prettier": "^5.2.2",
50
+ "globals": "^16.0.0",
51
+ "jest": "^30.0.0",
52
+ "prettier": "^3.4.2",
53
+ "source-map-support": "^0.5.21",
54
+ "supertest": "^7.0.0",
55
+ "ts-jest": "^29.2.5",
56
+ "ts-loader": "^9.5.2",
57
+ "ts-node": "^10.9.2",
58
+ "tsconfig-paths": "^4.2.0",
59
+ "typescript": "^5.7.3",
60
+ "typescript-eslint": "^8.20.0"
61
+ },
62
+ "jest": {
63
+ "moduleFileExtensions": [
64
+ "js",
65
+ "json",
66
+ "ts"
67
+ ],
68
+ "rootDir": "src",
69
+ "testRegex": ".*\\.spec\\.ts$",
70
+ "transform": {
71
+ "^.+\\.(t|j)s$": "ts-jest"
72
+ },
73
+ "collectCoverageFrom": [
74
+ "**/*.(t|j)s"
75
+ ],
76
+ "coverageDirectory": "../coverage",
77
+ "testEnvironment": "node"
78
+ }
79
+ }
@@ -0,0 +1,26 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { getDbModels } from '../libs/tatayab-entities-library/src';
3
+ import { SequelizeModule } from '@nestjs/sequelize';
4
+ import { ConfigModule } from '@nestjs/config';
5
+
6
+ @Module({
7
+ imports: [
8
+ ConfigModule.forRoot({
9
+ isGlobal: true,
10
+ }),
11
+ SequelizeModule.forRoot({
12
+ dialect: 'mysql',
13
+ host: process.env.MYSQL_HOST,
14
+ database: process.env.MYSQL_DATABASE,
15
+ username: process.env.MYSQL_USER,
16
+ password: process.env.MYSQL_PASSWORD,
17
+ port: 3306,
18
+ autoLoadModels: true,
19
+ synchronize: true,
20
+ logging: false,
21
+ models: getDbModels(),
22
+ }),
23
+ ],
24
+ providers: [],
25
+ })
26
+ export class AppModule {}
@@ -0,0 +1,35 @@
1
+ require('dotenv').config();
2
+ module.exports = {
3
+ DEVELOPMENT: {
4
+ dialect: 'mysql',
5
+ host: process.env.MYSQL_HOST,
6
+ port: process.env.MYSQL_PORT,
7
+ username: process.env.MYSQL_USER,
8
+ password: process.env.MYSQL_PASS,
9
+ database: process.env.MYSQL_DATABASE,
10
+ },
11
+ LOCAL: {
12
+ dialect: 'mysql',
13
+ host: process.env.MYSQL_HOST,
14
+ port: process.env.MYSQL_PORT,
15
+ username: process.env.MYSQL_USER,
16
+ password: process.env.MYSQL_PASS,
17
+ database: process.env.MYSQL_DATABASE,
18
+ },
19
+ STAGING: {
20
+ dialect: 'mysql',
21
+ host: process.env.MYSQL_HOST,
22
+ port: process.env.MYSQL_PORT,
23
+ username: process.env.MYSQL_USER,
24
+ password: process.env.MYSQL_PASS,
25
+ database: process.env.MYSQL_DATABASE,
26
+ },
27
+ PRODUCTION: {
28
+ dialect: 'mysql',
29
+ host: process.env.MYSQL_HOST,
30
+ port: process.env.MYSQL_PORT,
31
+ username: process.env.MYSQL_USER,
32
+ password: process.env.MYSQL_PASS,
33
+ database: process.env.MYSQL_DATABASE,
34
+ },
35
+ };
package/src/main.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { NestFactory } from '@nestjs/core';
2
+ import { AppModule } from './app.module';
3
+
4
+ async function bootstrap() {
5
+ const app = await NestFactory.create(AppModule, { cors: true });
6
+ await app.listen(process.env.SERVER_PORT ?? 9004);
7
+ }
8
+ bootstrap();
@@ -0,0 +1,25 @@
1
+ import { Test, TestingModule } from '@nestjs/testing';
2
+ import { INestApplication } from '@nestjs/common';
3
+ import request from 'supertest';
4
+ import { App } from 'supertest/types';
5
+ import { AppModule } from './../src/app.module';
6
+
7
+ describe('AppController (e2e)', () => {
8
+ let app: INestApplication<App>;
9
+
10
+ beforeEach(async () => {
11
+ const moduleFixture: TestingModule = await Test.createTestingModule({
12
+ imports: [AppModule],
13
+ }).compile();
14
+
15
+ app = moduleFixture.createNestApplication();
16
+ await app.init();
17
+ });
18
+
19
+ it('/ (GET)', () => {
20
+ return request(app.getHttpServer())
21
+ .get('/')
22
+ .expect(200)
23
+ .expect('Hello World!');
24
+ });
25
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "moduleFileExtensions": ["js", "json", "ts"],
3
+ "rootDir": ".",
4
+ "testEnvironment": "node",
5
+ "testRegex": ".e2e-spec.ts$",
6
+ "transform": {
7
+ "^.+\\.(t|j)s$": "ts-jest"
8
+ }
9
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "nodenext",
4
+ "moduleResolution": "nodenext",
5
+ "resolvePackageJsonExports": true,
6
+ "esModuleInterop": true,
7
+ "isolatedModules": true,
8
+ "declaration": true,
9
+ "removeComments": true,
10
+ "emitDecoratorMetadata": true,
11
+ "experimentalDecorators": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "target": "ES2023",
14
+ "sourceMap": true,
15
+ "outDir": "./dist",
16
+ "baseUrl": "./",
17
+ "incremental": true,
18
+ "skipLibCheck": true,
19
+ "strictNullChecks": true,
20
+ "forceConsistentCasingInFileNames": true,
21
+ "noImplicitAny": false,
22
+ "strictBindCallApply": false,
23
+ "noFallthroughCasesInSwitch": false
24
+ }
25
+ }