@appxdigital/appx-core-cli 1.0.11 → 1.0.12

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@appxdigital/appx-core-cli",
4
- "version": "1.0.11",
4
+ "version": "1.0.12",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "npm:publish": "npm publish --access public",
@@ -15,12 +15,13 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@inquirer/prompts": "^7.0.0",
18
- "@nestjs/cli": "^11.0.6",
19
18
  "cli-progress": "^3.12.0",
20
19
  "commander": "^12.1.0",
21
20
  "fs-extra": "^11.2.0",
22
21
  "handlebars": "^4.7.8",
23
- "inquirer": "^12.0.0"
22
+ "inquirer": "^12.0.0",
23
+ "mysql2": "^3.16.1",
24
+ "pg": "^8.17.1"
24
25
  },
25
26
  "description": ""
26
27
  }
@@ -0,0 +1,33 @@
1
+ ##DataBase Configurations##
2
+ DB_HOST={{DB_HOST}}
3
+ DB_PORT={{DB_PORT}}
4
+ DB_USER={{DB_USER}}
5
+ DB_PASSWORD={{DB_PASSWORD}}
6
+ DB_NAME={{DB_NAME}}
7
+ DB_PROVIDER={{DB_PROVIDER}}
8
+ DB_URL="${DB_PROVIDER}://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}"
9
+
10
+ ##Project configurations##
11
+
12
+ #Port
13
+ APP_PORT=3000
14
+
15
+ #Default behaviour for use of transactions
16
+ USE_TRANSACTION=true
17
+
18
+ #Session secret
19
+ SESSION_SECRET="{{SESSION_SECRET}}"
20
+
21
+ #Cookie name for the session token
22
+ SESSION_COOKIE_NAME="{{SESSION_COOKIE_NAME}}"
23
+
24
+ #Expiration time for the session token in seconds
25
+ SESSION_TTL=86400
26
+
27
+ # JWT expiration times
28
+ JWT_EXPIRES_IN=10d
29
+ JWT_REFRESH_EXPIRES_IN=1y
30
+
31
+ # JWT
32
+ JWT_SECRET="{{JWT_SECRET}}"
33
+ JWT_REFRESH_SECRET="{{JWT_REFRESH_SECRET}}"
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ parserOptions: {
4
+ project: 'tsconfig.json',
5
+ tsconfigRootDir: __dirname,
6
+ sourceType: 'module',
7
+ },
8
+ plugins: ['@typescript-eslint/eslint-plugin'],
9
+ extends: [
10
+ 'plugin:@typescript-eslint/recommended',
11
+ 'plugin:prettier/recommended',
12
+ ],
13
+ root: true,
14
+ env: {
15
+ node: true,
16
+ jest: true,
17
+ },
18
+ ignorePatterns: ['.eslintrc.js'],
19
+ rules: {
20
+ '@typescript-eslint/interface-name-prefix': 'off',
21
+ '@typescript-eslint/explicit-function-return-type': 'off',
22
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
23
+ '@typescript-eslint/no-explicit-any': 'off',
24
+ 'prettier/prettier': ['error', {endOfLine: 'lf'}],
25
+ },
26
+ };
@@ -0,0 +1,2 @@
1
+
2
+ * text=auto eol=lf
@@ -0,0 +1,9 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all",
4
+ "endOfLine": "lf",
5
+ "tabWidth": 2,
6
+ "semi": true,
7
+ "bracketSpacing": true,
8
+ "jsxBracketSameLine": true
9
+ }
@@ -0,0 +1,47 @@
1
+ datasource db {
2
+ provider = "{{DB_PROVIDER}}"
3
+ url = env("DB_URL")
4
+ }
5
+
6
+ generator client {
7
+ provider = "prisma-client-js"
8
+ }
9
+
10
+ generator nestgraphql {
11
+ provider = "node node_modules/prisma-nestjs-graphql"
12
+ output = "../src/generated/"
13
+ }
14
+
15
+ model User {
16
+ id Int @id @default(autoincrement())
17
+ email String @unique
18
+ name String?
19
+ password String? /// @Role(none)
20
+ role Role @default(GUEST)
21
+ refreshTokens UserRefreshToken[]
22
+ }
23
+
24
+ model Session {
25
+ id String @id
26
+ sid String @unique
27
+ data String @db.Text
28
+ expiresAt DateTime
29
+ userId Int?
30
+ }
31
+
32
+ model UserRefreshToken {
33
+ id String @id @default(cuid())
34
+ token String @unique @db.VarChar(255)
35
+ userId Int
36
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
37
+ expiresAt DateTime
38
+ createdAt DateTime @default(now())
39
+ revokedAt DateTime?
40
+
41
+ @@index([userId])
42
+ }
43
+
44
+ enum Role {
45
+ ADMIN
46
+ GUEST
47
+ }
@@ -0,0 +1,13 @@
1
+ import {Controller, Get} from '@nestjs/common';
2
+ import {AppService} from './app.service';
3
+
4
+ @Controller()
5
+ export class AppController {
6
+ constructor(private readonly appService: AppService) {
7
+ }
8
+
9
+ @Get()
10
+ getHello(): string {
11
+ return this.appService.getHello();
12
+ }
13
+ }
@@ -2,8 +2,8 @@ import {MiddlewareConsumer, Module, NestModule, RequestMethod} from '@nestjs/com
2
2
  import {AppController} from './app.controller';
3
3
  import {AppService} from './app.service';
4
4
  import {ConfigModule} from '@nestjs/config';
5
- import {AuthModule, PrismaInterceptor, AppxCoreModule, AppxCoreAdminModule} from '@appxdigital/appx-core';
6
- import {APP_INTERCEPTOR} from '@nestjs/core';
5
+ import {AuthModule, PrismaInterceptor, AppxCoreModule, AppxCoreAdminModule, UserPopulationGuard} from '@appxdigital/appx-core';
6
+ import {APP_INTERCEPTOR, APP_GUARD} from '@nestjs/core';
7
7
  import {RequestContextModule, RequestContextMiddleware} from 'nestjs-request-context'
8
8
  import {PermissionsConfig} from './config/permissions.config';
9
9
  import {AdminConfig} from './config/admin.config';
@@ -28,6 +28,10 @@ import {AdminConfig} from './config/admin.config';
28
28
  provide: APP_INTERCEPTOR,
29
29
  useClass: PrismaInterceptor,
30
30
  },
31
+ {
32
+ provide: APP_GUARD,
33
+ useClass: UserPopulationGuard,
34
+ },
31
35
  ],
32
36
  })
33
37
  export class AppModule implements NestModule {
@@ -0,0 +1,8 @@
1
+ import {Injectable} from '@nestjs/common';
2
+
3
+ @Injectable()
4
+ export class AppService {
5
+ getHello(): string {
6
+ return 'Hello World!';
7
+ }
8
+ }
@@ -1,12 +1,12 @@
1
1
  import { NestFactory } from '@nestjs/core';
2
2
  import { AppModule } from './app.module';
3
3
  import { ConfigService } from '@nestjs/config';
4
- import * as session from 'express-session';
5
- import * as passport from 'passport';
4
+ import session from 'express-session';
5
+ import passport from 'passport';
6
6
  import {PrismaService} from '@appxdigital/appx-core';
7
7
  import { ValidationPipe } from '@nestjs/common';
8
8
  import {CorePrismaSessionStore} from '@appxdigital/appx-core';
9
- import * as morgan from 'morgan';
9
+ import morgan from 'morgan';
10
10
 
11
11
  async function bootstrap() {
12
12
  const app = await NestFactory.create(AppModule);