From feed886e8b9fc59f621c929ca9db0f3745949afe Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:13:43 +0000 Subject: [PATCH 01/85] amplication --- apps/logistic-server/.env | 6 +- apps/logistic-server/.gitignore | 5 +- apps/logistic-server/Dockerfile | 4 +- apps/logistic-server/README.md | 87 +++++++++++++ apps/logistic-server/package.json | 2 +- apps/logistic-server/src/app.module.ts | 2 + apps/logistic-server/src/auth/UserInfo.ts | 2 +- .../src/auth/auth.service.spec.ts | 118 ++++++++++++++++++ .../auth/basic/base/basic.strategy.base.ts | 3 +- .../src/auth/password.service.spec.ts | 67 ++++++++++ .../src/health/base/health.service.base.ts | 2 +- apps/logistic-server/src/prisma.util.spec.ts | 23 ++++ .../src/prisma/prisma.module.ts | 9 ++ .../src/prisma/prisma.service.ts | 15 +++ .../base/secretsManager.service.base.spec.ts | 39 ++++++ .../src/shipment/base/Shipment.ts | 2 + .../src/shipment/base/ShipmentCreateInput.ts | 2 + .../src/shipment/base/ShipmentUpdateInput.ts | 2 + .../src/shipment/base/ShipmentWhereInput.ts | 2 + .../shipment/base/ShipmentWhereUniqueInput.ts | 2 + ...seCreateNestedManyWithoutShipmentsInput.ts | 2 + ...arehouseUpdateManyWithoutShipmentsInput.ts | 2 + .../src/shipment/base/shipment.module.base.ts | 10 +- .../shipment/base/shipment.service.base.ts | 2 +- apps/logistic-server/src/swagger.ts | 6 +- .../src/tests/auth/jwt/jwt.strategy.spec.ts | 27 ++++ .../src/tests/health/health.service.spec.ts | 36 ++++++ apps/logistic-server/src/types.ts | 2 +- apps/logistic-server/src/user/base/User.ts | 2 + .../src/user/base/UserCreateInput.ts | 2 + .../src/user/base/UserUpdateInput.ts | 2 + .../src/user/base/UserWhereInput.ts | 2 + .../src/user/base/UserWhereUniqueInput.ts | 2 + .../src/user/base/user.module.base.ts | 10 +- .../src/user/base/user.service.base.ts | 2 +- .../src/util/JsonNullableFilter.ts | 2 +- ...tCreateNestedManyWithoutWarehousesInput.ts | 2 + ...hipmentUpdateManyWithoutWarehousesInput.ts | 2 + .../src/warehouse/base/Warehouse.ts | 2 + .../warehouse/base/WarehouseCreateInput.ts | 2 + .../warehouse/base/WarehouseUpdateInput.ts | 2 + .../src/warehouse/base/WarehouseWhereInput.ts | 2 + .../base/WarehouseWhereUniqueInput.ts | 2 + .../warehouse/base/warehouse.module.base.ts | 10 +- .../warehouse/base/warehouse.service.base.ts | 2 +- 45 files changed, 486 insertions(+), 45 deletions(-) create mode 100644 apps/logistic-server/README.md create mode 100644 apps/logistic-server/src/auth/auth.service.spec.ts create mode 100644 apps/logistic-server/src/auth/password.service.spec.ts create mode 100644 apps/logistic-server/src/prisma.util.spec.ts create mode 100644 apps/logistic-server/src/prisma/prisma.module.ts create mode 100644 apps/logistic-server/src/prisma/prisma.service.ts create mode 100644 apps/logistic-server/src/providers/secrets/base/secretsManager.service.base.spec.ts create mode 100644 apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts create mode 100644 apps/logistic-server/src/tests/health/health.service.spec.ts diff --git a/apps/logistic-server/.env b/apps/logistic-server/.env index 9fdea0d..b8d09a0 100644 --- a/apps/logistic-server/.env +++ b/apps/logistic-server/.env @@ -6,8 +6,8 @@ PORT=3000 DB_USER=root DB_PASSWORD=admin DB_PORT=3306 -DB_URL=mysql://root:admin@localhost:3306/my-service +DB_URL=mysql://root:admin@localhost:3306/logistic KAFKA_BROKERS=localhost:9092 KAFKA_ENABLE_SSL=false -KAFKA_CLIENT_ID=my-service -KAFKA_GROUP_ID=my-service \ No newline at end of file +KAFKA_CLIENT_ID=logistic +KAFKA_GROUP_ID=logistic \ No newline at end of file diff --git a/apps/logistic-server/.gitignore b/apps/logistic-server/.gitignore index b65b772..08c9980 100644 --- a/apps/logistic-server/.gitignore +++ b/apps/logistic-server/.gitignore @@ -1,6 +1,5 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - - + /node_modules /dist -.DS_Store \ No newline at end of file +.DS_Store diff --git a/apps/logistic-server/Dockerfile b/apps/logistic-server/Dockerfile index 586f38c..0a20053 100644 --- a/apps/logistic-server/Dockerfile +++ b/apps/logistic-server/Dockerfile @@ -1,4 +1,4 @@ -FROM node:19.1 AS base +FROM node:18.12.1 AS base WORKDIR /app @@ -14,7 +14,7 @@ COPY . . RUN npm run build -FROM node:19.1 AS prod +FROM node:18.12.1 AS prod WORKDIR /app diff --git a/apps/logistic-server/README.md b/apps/logistic-server/README.md new file mode 100644 index 0000000..a43c337 --- /dev/null +++ b/apps/logistic-server/README.md @@ -0,0 +1,87 @@ +# Getting started with your app + +## Available Scripts + +In the `server` subdirectory, you can run: + +### `npm start` + +Runs the app in development mode. +By default, it is accessible at http://localhost:3000 + +### `npm test` + +Runs tests. + +### `npm run build` + +Builds the app for production in the `dist` folder. + +Your app is ready to be deployed! + +## Environment Variables: + +| Environment | Description | Value | +| -------------------- | ---------------------------------------- | ---------------------------------------------------------- | +| DEBUG_MODE | Debug level | 1 | +| DB_URL | Local database connection URL | db-provider://admin:admin@localhost:${DB_PORT}/\${DB_NAME} | +| DB_PORT | Local database port | | +| DB_USER | Local database username | admin | +| DB_PASSWORD | Local database password | admin | +| COMPOSE_PROJECT_NAME | Docker Compose project name | amp\_{applicationId} | +| SERVER_PORT | The port that the server is listening to | 3000 | +| JWT_SECRET_KEY | JWT secret | Change_ME!!! | +| JWT_EXPIRATION | JWT expiration in days | 2d | + +\*db-provider - the prisma DB provider (for example: for postgres is postgresql and for MySQL is mysql) + +## Getting Started - Local Development + +### Prerequisites + +Make sure you have Node.js 16.x, npm, and Docker installed. + +### Install dependencies + +In the `server` subdirectory, run: + +```console +cd server +npm install +``` + +### Generate Prisma client + +```console +npm run prisma:generate +``` + +### Start database using Docker + +```console +npm run docker:db +``` + +### Initialize the database + +```console +npm run db:init +``` + +### Start the server + +```console +npm start +``` + +## Getting Started - Docker Compose + +In the `server` subdirectory, run: + +```console +npm run compose:up +``` + +## Learn more + +You can learn more in the [Amplication documentation](https://docs.amplication.com/guides/getting-started). diff --git a/apps/logistic-server/package.json b/apps/logistic-server/package.json index 4f625b5..6cca8f5 100644 --- a/apps/logistic-server/package.json +++ b/apps/logistic-server/package.json @@ -1,5 +1,5 @@ { - "name": "@my-service/server", + "name": "@logistic/server", "private": true, "scripts": { "start": "nest start", diff --git a/apps/logistic-server/src/app.module.ts b/apps/logistic-server/src/app.module.ts index e3a7b23..9a4b843 100644 --- a/apps/logistic-server/src/app.module.ts +++ b/apps/logistic-server/src/app.module.ts @@ -7,6 +7,7 @@ import { ShipmentModule } from "./shipment/shipment.module"; import { ACLModule } from "./auth/acl.module"; import { AuthModule } from "./auth/auth.module"; import { HealthModule } from "./health/health.module"; +import { PrismaModule } from "./prisma/prisma.module"; import { SecretsManagerModule } from "./providers/secrets/secretsManager.module"; import { KafkaModule } from "./kafka/kafka.module"; import { ConfigModule, ConfigService } from "@nestjs/config"; @@ -23,6 +24,7 @@ import { GraphQLModule } from "@nestjs/graphql"; ACLModule, AuthModule, HealthModule, + PrismaModule, SecretsManagerModule, KafkaModule, MorganModule, diff --git a/apps/logistic-server/src/auth/UserInfo.ts b/apps/logistic-server/src/auth/UserInfo.ts index f1b1d3c..ef61dc4 100644 --- a/apps/logistic-server/src/auth/UserInfo.ts +++ b/apps/logistic-server/src/auth/UserInfo.ts @@ -1,5 +1,5 @@ import { Field, ObjectType } from "@nestjs/graphql"; -import { User } from "../user/base/user"; +import { User } from "../user/base/User"; @ObjectType() export class UserInfo implements Partial { diff --git a/apps/logistic-server/src/auth/auth.service.spec.ts b/apps/logistic-server/src/auth/auth.service.spec.ts new file mode 100644 index 0000000..aaa68e4 --- /dev/null +++ b/apps/logistic-server/src/auth/auth.service.spec.ts @@ -0,0 +1,118 @@ +import { Test, TestingModule } from "@nestjs/testing"; +// @ts-ignore +// eslint-disable-next-line +import { UserService } from "../user/user.service"; +import { AuthService } from "./auth.service"; +import { Credentials } from "./Credentials"; +import { PasswordService } from "./password.service"; +// @ts-ignore +// eslint-disable-next-line +import { TokenService } from "./token.service"; +import { VALID_ID } from "../tests/auth/constants"; + +const VALID_CREDENTIALS: Credentials = { + username: "Valid User", + password: "Valid User Password", +}; +const INVALID_CREDENTIALS: Credentials = { + username: "Invalid User", + password: "Invalid User Password", +}; +const USER: any = { + ...VALID_CREDENTIALS, + createdAt: new Date(), + firstName: "ofek", + id: VALID_ID, + lastName: "gabay", + roles: ["admin"], + updatedAt: new Date(), +}; + +const SIGN_TOKEN = "SIGN_TOKEN"; + +const userService = { + findOne(args: { where: { username: string } }): any | null { + if (args.where.username === VALID_CREDENTIALS.username) { + return USER; + } + return null; + }, +}; + +const passwordService = { + compare(password: string, encrypted: string) { + return true; + }, +}; + +const tokenService = { + createToken(username: string, password: string) { + return SIGN_TOKEN; + }, +}; + +describe("AuthService", () => { + //ARRANGE + let service: AuthService; + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + { + provide: UserService, + useValue: userService, + }, + { + provide: PasswordService, + useValue: passwordService, + }, + { + provide: TokenService, + useValue: tokenService, + }, + AuthService, + ], + }).compile(); + + service = module.get(AuthService); + }); + + it("should be defined", () => { + expect(service).toBeDefined(); + }); + + describe("Testing the authService.validateUser()", () => { + it("should validate a valid user", async () => { + await expect( + service.validateUser( + VALID_CREDENTIALS.username, + VALID_CREDENTIALS.password + ) + ).resolves.toEqual({ + username: USER.username, + roles: USER.roles, + id: USER.id, + }); + }); + + it("should not validate a invalid user", async () => { + await expect( + service.validateUser( + INVALID_CREDENTIALS.username, + INVALID_CREDENTIALS.password + ) + ).resolves.toBe(null); + }); + }); + + describe("Testing the authService.login()", () => { + it("should return userInfo object for correct username and password", async () => { + const loginResult = await service.login(VALID_CREDENTIALS); + expect(loginResult).toEqual({ + username: USER.username, + roles: USER.roles, + accessToken: SIGN_TOKEN, + id: USER.id, + }); + }); + }); +}); diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/auth/password.service.spec.ts b/apps/logistic-server/src/auth/password.service.spec.ts new file mode 100644 index 0000000..72f21a9 --- /dev/null +++ b/apps/logistic-server/src/auth/password.service.spec.ts @@ -0,0 +1,67 @@ +import { ConfigService } from "@nestjs/config"; +import { Test, TestingModule } from "@nestjs/testing"; +import { PasswordService } from "./password.service"; +import * as bcrypt from "bcrypt"; + +const EXAMPLE_PASSWORD = "examplePassword"; +const EXAMPLE_HASHED_PASSWORD = "exampleHashedPassword"; + +const EXAMPLE_SALT_OR_ROUNDS = 1; + +const configServiceGetMock = jest.fn(() => { + return EXAMPLE_SALT_OR_ROUNDS; +}); + +jest.mock("bcrypt"); + +//@ts-ignore +bcrypt.hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); + +//@ts-ignore +bcrypt.compare.mockImplementation(async () => true); + +describe("PasswordService", () => { + let service: PasswordService; + + beforeEach(async () => { + jest.clearAllMocks(); + const module: TestingModule = await Test.createTestingModule({ + providers: [ + PasswordService, + { + provide: ConfigService, + useClass: jest.fn(() => ({ + get: configServiceGetMock, + })), + }, + ], + imports: [], + }).compile(); + + service = module.get(PasswordService); + }); + + it("should be defined", () => { + expect(service).toBeDefined(); + }); + + it("should have salt defined", () => { + expect(service.salt).toEqual(EXAMPLE_SALT_OR_ROUNDS); + }); + + it("should compare a password", async () => { + const args = { + password: EXAMPLE_PASSWORD, + hashedPassword: EXAMPLE_HASHED_PASSWORD, + }; + await expect( + service.compare(args.password, args.hashedPassword) + ).resolves.toEqual(true); + }); + + it("should hash a password", async () => { + await expect(service.hash(EXAMPLE_PASSWORD)).resolves.toEqual( + EXAMPLE_HASHED_PASSWORD + ); + }); +}); diff --git a/apps/logistic-server/src/health/base/health.service.base.ts b/apps/logistic-server/src/health/base/health.service.base.ts index 0db85da..49a93a5 100644 --- a/apps/logistic-server/src/health/base/health.service.base.ts +++ b/apps/logistic-server/src/health/base/health.service.base.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; @Injectable() export class HealthServiceBase { diff --git a/apps/logistic-server/src/prisma.util.spec.ts b/apps/logistic-server/src/prisma.util.spec.ts new file mode 100644 index 0000000..0aa308e --- /dev/null +++ b/apps/logistic-server/src/prisma.util.spec.ts @@ -0,0 +1,23 @@ +import { + isRecordNotFoundError, + PRISMA_QUERY_INTERPRETATION_ERROR, +} from "./prisma.util"; + +describe("isRecordNotFoundError", () => { + test("returns true for record not found error", () => { + expect( + isRecordNotFoundError( + Object.assign( + new Error(`Error occurred during query execution: + InterpretationError("Error for binding '0': RecordNotFound("Record to update not found.")")`), + { + code: PRISMA_QUERY_INTERPRETATION_ERROR, + } + ) + ) + ).toBe(true); + }); + test("returns false for any other error", () => { + expect(isRecordNotFoundError(new Error())).toBe(false); + }); +}); diff --git a/apps/logistic-server/src/prisma/prisma.module.ts b/apps/logistic-server/src/prisma/prisma.module.ts new file mode 100644 index 0000000..1edbf95 --- /dev/null +++ b/apps/logistic-server/src/prisma/prisma.module.ts @@ -0,0 +1,9 @@ +import { Global, Module } from "@nestjs/common"; +import { PrismaService } from "./prisma.service"; + +@Global() +@Module({ + providers: [PrismaService], + exports: [PrismaService], +}) +export class PrismaModule {} diff --git a/apps/logistic-server/src/prisma/prisma.service.ts b/apps/logistic-server/src/prisma/prisma.service.ts new file mode 100644 index 0000000..3fb4081 --- /dev/null +++ b/apps/logistic-server/src/prisma/prisma.service.ts @@ -0,0 +1,15 @@ +import { Injectable, OnModuleInit, INestApplication } 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(); + }); + } +} diff --git a/apps/logistic-server/src/providers/secrets/base/secretsManager.service.base.spec.ts b/apps/logistic-server/src/providers/secrets/base/secretsManager.service.base.spec.ts new file mode 100644 index 0000000..0b5a709 --- /dev/null +++ b/apps/logistic-server/src/providers/secrets/base/secretsManager.service.base.spec.ts @@ -0,0 +1,39 @@ +import { ConfigService } from "@nestjs/config"; +import { mock } from "jest-mock-extended"; +import { SecretsManagerServiceBase } from "./secretsManager.service.base"; + +describe("Testing the secrets manager base class", () => { + const SECRET_KEY = "SECRET_KEY"; + const SECRET_VALUE = "SECRET_VALUE"; + const configService = mock(); + const secretsManagerServiceBase = new SecretsManagerServiceBase( + configService + ); + beforeEach(() => { + configService.get.mockClear(); + }); + it("should return value from env", async () => { + //ARRANGE + configService.get.mockReturnValue(SECRET_VALUE); + //ACT + const result = await secretsManagerServiceBase.getSecret(SECRET_KEY); + //ASSERT + expect(result).toBe(SECRET_VALUE); + }); + it("should return null for unknown keys", async () => { + //ARRANGE + configService.get.mockReturnValue(undefined); + //ACT + const result = await secretsManagerServiceBase.getSecret(SECRET_KEY); + //ASSERT + expect(result).toBeNull(); + }); + it("should throw error if dont get key", () => { + //@ts-ignore + return expect(secretsManagerServiceBase.getSecret()).rejects.toThrow(); + }); + it("should throw an exeption if getting null key", () => { + //@ts-ignore + return expect(secretsManagerServiceBase.getSecret(null)).rejects.toThrow(); + }); +}); diff --git a/apps/logistic-server/src/shipment/base/Shipment.ts b/apps/logistic-server/src/shipment/base/Shipment.ts index f57780e..a1444cb 100644 --- a/apps/logistic-server/src/shipment/base/Shipment.ts +++ b/apps/logistic-server/src/shipment/base/Shipment.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsDate, IsString, IsOptional, ValidateNested } from "class-validator"; import { Type } from "class-transformer"; import { Warehouse } from "../../warehouse/base/Warehouse"; + @ObjectType() class Shipment { @ApiProperty({ @@ -60,4 +61,5 @@ class Shipment { @IsOptional() warehouse?: Array; } + export { Shipment }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts b/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts index 4def36b..a4d3770 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, ValidateNested } from "class-validator"; import { WarehouseCreateNestedManyWithoutShipmentsInput } from "./WarehouseCreateNestedManyWithoutShipmentsInput"; import { Type } from "class-transformer"; + @InputType() class ShipmentCreateInput { @ApiProperty({ @@ -39,4 +40,5 @@ class ShipmentCreateInput { }) warehouse?: WarehouseCreateNestedManyWithoutShipmentsInput; } + export { ShipmentCreateInput }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts b/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts index 3eb0f72..e67a968 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, ValidateNested } from "class-validator"; import { WarehouseUpdateManyWithoutShipmentsInput } from "./WarehouseUpdateManyWithoutShipmentsInput"; import { Type } from "class-transformer"; + @InputType() class ShipmentUpdateInput { @ApiProperty({ @@ -39,4 +40,5 @@ class ShipmentUpdateInput { }) warehouse?: WarehouseUpdateManyWithoutShipmentsInput; } + export { ShipmentUpdateInput }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts b/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts index 6882b72..d02d196 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts @@ -16,6 +16,7 @@ import { Type } from "class-transformer"; import { IsOptional, ValidateNested } from "class-validator"; import { StringNullableFilter } from "../../util/StringNullableFilter"; import { WarehouseListRelationFilter } from "../../warehouse/base/WarehouseListRelationFilter"; + @InputType() class ShipmentWhereInput { @ApiProperty({ @@ -52,4 +53,5 @@ class ShipmentWhereInput { }) warehouse?: WarehouseListRelationFilter; } + export { ShipmentWhereInput }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts b/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts index 8628674..80ea33d 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class ShipmentWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class ShipmentWhereUniqueInput { @Field(() => String) id!: string; } + export { ShipmentWhereUniqueInput }; diff --git a/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts b/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts index 08aa951..fa66aeb 100644 --- a/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts +++ b/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { WarehouseWhereUniqueInput } from "../../warehouse/base/WarehouseWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class WarehouseCreateNestedManyWithoutShipmentsInput { @Field(() => [WarehouseWhereUniqueInput], { @@ -23,4 +24,5 @@ class WarehouseCreateNestedManyWithoutShipmentsInput { }) connect?: Array; } + export { WarehouseCreateNestedManyWithoutShipmentsInput }; diff --git a/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts b/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts index f56a80c..bc73a6b 100644 --- a/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts +++ b/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { WarehouseWhereUniqueInput } from "../../warehouse/base/WarehouseWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class WarehouseUpdateManyWithoutShipmentsInput { @Field(() => [WarehouseWhereUniqueInput], { @@ -41,4 +42,5 @@ class WarehouseUpdateManyWithoutShipmentsInput { }) set?: Array; } + export { WarehouseUpdateManyWithoutShipmentsInput }; diff --git a/apps/logistic-server/src/shipment/base/shipment.module.base.ts b/apps/logistic-server/src/shipment/base/shipment.module.base.ts index 487480d..d5bd55c 100644 --- a/apps/logistic-server/src/shipment/base/shipment.module.base.ts +++ b/apps/logistic-server/src/shipment/base/shipment.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class ShipmentModuleBase {} diff --git a/apps/logistic-server/src/shipment/base/shipment.service.base.ts b/apps/logistic-server/src/shipment/base/shipment.service.base.ts index d8dfcd4..2c286ce 100644 --- a/apps/logistic-server/src/shipment/base/shipment.service.base.ts +++ b/apps/logistic-server/src/shipment/base/shipment.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, Shipment, Warehouse } from "@prisma/client"; export class ShipmentServiceBase { diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 0b80c3e..73fcbfb 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -3,11 +3,11 @@ import { DocumentBuilder, SwaggerCustomOptions } from "@nestjs/swagger"; export const swaggerPath = "api"; export const swaggerDocumentOptions = new DocumentBuilder() - .setTitle("My service") + .setTitle("logistic") .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("6nccm290") + .setVersion("dbjghie7") .addBearerAuth() .build(); @@ -17,5 +17,5 @@ export const swaggerSetupOptions: SwaggerCustomOptions = { }, customCssUrl: "../swagger/swagger.css", customfavIcon: "../swagger/favicon.png", - customSiteTitle: "My service", + customSiteTitle: "logistic", }; diff --git a/apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts b/apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts new file mode 100644 index 0000000..cc701e1 --- /dev/null +++ b/apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts @@ -0,0 +1,27 @@ +import { UnauthorizedException } from "@nestjs/common"; +import { mock } from "jest-mock-extended"; +import { JwtStrategyBase } from "../../../auth/jwt/base/jwt.strategy.base"; +import { UserService } from "../../../user/user.service"; +import { TEST_USER } from "../constants"; + +describe("Testing the jwtStrategyBase.validate()", () => { + const userService = mock(); + const jwtStrategy = new JwtStrategyBase(userService, "Secrete"); + beforeEach(() => { + userService.findOne.mockClear(); + }); + it("should throw UnauthorizedException where there is no user", async () => { + //ARRANGE + userService.findOne + .calledWith({ where: { username: TEST_USER.username } }) + .mockReturnValue(Promise.resolve(null)); + //ACT + const result = jwtStrategy.validate({ + id: TEST_USER.id, + username: TEST_USER.username, + roles: TEST_USER.roles, + }); + //ASSERT + return expect(result).rejects.toThrowError(UnauthorizedException); + }); +}); diff --git a/apps/logistic-server/src/tests/health/health.service.spec.ts b/apps/logistic-server/src/tests/health/health.service.spec.ts new file mode 100644 index 0000000..f7cd00b --- /dev/null +++ b/apps/logistic-server/src/tests/health/health.service.spec.ts @@ -0,0 +1,36 @@ +import { mock } from "jest-mock-extended"; +import { PrismaService } from "nestjs-prisma"; +import { HealthServiceBase } from "../../health/base/health.service.base"; + +describe("Testing the HealthServiceBase", () => { + //ARRANGE + let prismaService: PrismaService; + let healthServiceBase: HealthServiceBase; + + describe("Testing the isDbReady function in HealthServiceBase class", () => { + beforeEach(() => { + prismaService = mock(); + healthServiceBase = new HealthServiceBase(prismaService); + }); + it("should return true if allow connection to db", async () => { + //ARRANGE + prismaService.$queryRaw + //@ts-ignore + .mockReturnValue(Promise.resolve(true)); + //ACT + const response = await healthServiceBase.isDbReady(); + //ASSERT + expect(response).toBe(true); + }); + it("should return false if db is not available", async () => { + //ARRANGE + prismaService.$queryRaw + //@ts-ignore + .mockReturnValue(Promise.reject(false)); + //ACT + const response = await healthServiceBase.isDbReady(); + //ASSERT + expect(response).toBe(false); + }); + }); +}); diff --git a/apps/logistic-server/src/types.ts b/apps/logistic-server/src/types.ts index 16a8bd9..f762a5d 100644 --- a/apps/logistic-server/src/types.ts +++ b/apps/logistic-server/src/types.ts @@ -1,3 +1,3 @@ -import { JsonValue } from "type-fest"; +import type { JsonValue } from "type-fest"; export type InputJsonValue = Omit; diff --git a/apps/logistic-server/src/user/base/User.ts b/apps/logistic-server/src/user/base/User.ts index e9f87a5..29aaa2d 100644 --- a/apps/logistic-server/src/user/base/User.ts +++ b/apps/logistic-server/src/user/base/User.ts @@ -15,6 +15,7 @@ import { IsDate, IsString, IsOptional, IsJSON } from "class-validator"; import { Type } from "class-transformer"; import { GraphQLJSON } from "graphql-type-json"; import { JsonValue } from "type-fest"; + @ObjectType() class User { @ApiProperty({ @@ -78,4 +79,5 @@ class User { @Field(() => String) username!: string; } + export { User }; diff --git a/apps/logistic-server/src/user/base/UserCreateInput.ts b/apps/logistic-server/src/user/base/UserCreateInput.ts index 0be1f75..0e5ad32 100644 --- a/apps/logistic-server/src/user/base/UserCreateInput.ts +++ b/apps/logistic-server/src/user/base/UserCreateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, IsJSON } from "class-validator"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; + @InputType() class UserCreateInput { @ApiProperty({ @@ -61,4 +62,5 @@ class UserCreateInput { @Field(() => String) username!: string; } + export { UserCreateInput }; diff --git a/apps/logistic-server/src/user/base/UserUpdateInput.ts b/apps/logistic-server/src/user/base/UserUpdateInput.ts index 36115bf..73a0141 100644 --- a/apps/logistic-server/src/user/base/UserUpdateInput.ts +++ b/apps/logistic-server/src/user/base/UserUpdateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, IsJSON } from "class-validator"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; + @InputType() class UserUpdateInput { @ApiProperty({ @@ -70,4 +71,5 @@ class UserUpdateInput { }) username?: string; } + export { UserUpdateInput }; diff --git a/apps/logistic-server/src/user/base/UserWhereInput.ts b/apps/logistic-server/src/user/base/UserWhereInput.ts index 1a8088c..fd59ab5 100644 --- a/apps/logistic-server/src/user/base/UserWhereInput.ts +++ b/apps/logistic-server/src/user/base/UserWhereInput.ts @@ -15,6 +15,7 @@ import { StringNullableFilter } from "../../util/StringNullableFilter"; import { Type } from "class-transformer"; import { IsOptional } from "class-validator"; import { StringFilter } from "../../util/StringFilter"; + @InputType() class UserWhereInput { @ApiProperty({ @@ -61,4 +62,5 @@ class UserWhereInput { }) username?: StringFilter; } + export { UserWhereInput }; diff --git a/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts b/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts index 648452d..c711460 100644 --- a/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts +++ b/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class UserWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class UserWhereUniqueInput { @Field(() => String) id!: string; } + export { UserWhereUniqueInput }; diff --git a/apps/logistic-server/src/user/base/user.module.base.ts b/apps/logistic-server/src/user/base/user.module.base.ts index 6dc8244..ed8ce8d 100644 --- a/apps/logistic-server/src/user/base/user.module.base.ts +++ b/apps/logistic-server/src/user/base/user.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class UserModuleBase {} diff --git a/apps/logistic-server/src/user/base/user.service.base.ts b/apps/logistic-server/src/user/base/user.service.base.ts index 37a98b0..89d81db 100644 --- a/apps/logistic-server/src/user/base/user.service.base.ts +++ b/apps/logistic-server/src/user/base/user.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, User } from "@prisma/client"; import { PasswordService } from "../../auth/password.service"; import { transformStringFieldUpdateInput } from "../../prisma.util"; diff --git a/apps/logistic-server/src/util/JsonNullableFilter.ts b/apps/logistic-server/src/util/JsonNullableFilter.ts index 2750eaf..3381d52 100644 --- a/apps/logistic-server/src/util/JsonNullableFilter.ts +++ b/apps/logistic-server/src/util/JsonNullableFilter.ts @@ -1,4 +1,4 @@ -import { JsonValue } from "type-fest"; +import type { JsonValue } from "type-fest"; import { Field, InputType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsOptional } from "class-validator"; diff --git a/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts b/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts index 2cf7409..8645d95 100644 --- a/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts +++ b/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ShipmentWhereUniqueInput } from "../../shipment/base/ShipmentWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class ShipmentCreateNestedManyWithoutWarehousesInput { @Field(() => [ShipmentWhereUniqueInput], { @@ -23,4 +24,5 @@ class ShipmentCreateNestedManyWithoutWarehousesInput { }) connect?: Array; } + export { ShipmentCreateNestedManyWithoutWarehousesInput }; diff --git a/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts b/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts index fe02aa6..2a11e9c 100644 --- a/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts +++ b/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ShipmentWhereUniqueInput } from "../../shipment/base/ShipmentWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class ShipmentUpdateManyWithoutWarehousesInput { @Field(() => [ShipmentWhereUniqueInput], { @@ -41,4 +42,5 @@ class ShipmentUpdateManyWithoutWarehousesInput { }) set?: Array; } + export { ShipmentUpdateManyWithoutWarehousesInput }; diff --git a/apps/logistic-server/src/warehouse/base/Warehouse.ts b/apps/logistic-server/src/warehouse/base/Warehouse.ts index b073ebd..d00df8b 100644 --- a/apps/logistic-server/src/warehouse/base/Warehouse.ts +++ b/apps/logistic-server/src/warehouse/base/Warehouse.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, IsDate, ValidateNested } from "class-validator"; import { Type } from "class-transformer"; import { Shipment } from "../../shipment/base/Shipment"; + @ObjectType() class Warehouse { @ApiProperty({ @@ -71,4 +72,5 @@ class Warehouse { @Field(() => Date) updatedAt!: Date; } + export { Warehouse }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts index 9a6691e..a3cc63d 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, ValidateNested } from "class-validator"; import { ShipmentCreateNestedManyWithoutWarehousesInput } from "./ShipmentCreateNestedManyWithoutWarehousesInput"; import { Type } from "class-transformer"; + @InputType() class WarehouseCreateInput { @ApiProperty({ @@ -50,4 +51,5 @@ class WarehouseCreateInput { }) shipments?: ShipmentCreateNestedManyWithoutWarehousesInput; } + export { WarehouseCreateInput }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts index 8cff00a..9fa292f 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, ValidateNested } from "class-validator"; import { ShipmentUpdateManyWithoutWarehousesInput } from "./ShipmentUpdateManyWithoutWarehousesInput"; import { Type } from "class-transformer"; + @InputType() class WarehouseUpdateInput { @ApiProperty({ @@ -50,4 +51,5 @@ class WarehouseUpdateInput { }) shipments?: ShipmentUpdateManyWithoutWarehousesInput; } + export { WarehouseUpdateInput }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts index e81fbee..8661774 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts @@ -16,6 +16,7 @@ import { Type } from "class-transformer"; import { IsOptional, ValidateNested } from "class-validator"; import { StringFilter } from "../../util/StringFilter"; import { ShipmentListRelationFilter } from "../../shipment/base/ShipmentListRelationFilter"; + @InputType() class WarehouseWhereInput { @ApiProperty({ @@ -63,4 +64,5 @@ class WarehouseWhereInput { }) shipments?: ShipmentListRelationFilter; } + export { WarehouseWhereInput }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts index 6fbee35..bf457b4 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class WarehouseWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class WarehouseWhereUniqueInput { @Field(() => String) id!: string; } + export { WarehouseWhereUniqueInput }; diff --git a/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts b/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts index 5457fd1..24efee7 100644 --- a/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts +++ b/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class WarehouseModuleBase {} diff --git a/apps/logistic-server/src/warehouse/base/warehouse.service.base.ts b/apps/logistic-server/src/warehouse/base/warehouse.service.base.ts index a61225c..b9721f9 100644 --- a/apps/logistic-server/src/warehouse/base/warehouse.service.base.ts +++ b/apps/logistic-server/src/warehouse/base/warehouse.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, Warehouse, Shipment } from "@prisma/client"; export class WarehouseServiceBase { From ce8ee0d57a77847d54bc11005eef7efec3b16d8c Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:17:56 +0000 Subject: [PATCH 02/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 73fcbfb..99adbd1 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("dbjghie7") + .setVersion("2t90804h") .addBearerAuth() .build(); From 8e00e69153c97e8042025bbb2a06f3df7c622ea5 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:19:46 +0000 Subject: [PATCH 03/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 99adbd1..7c37e2b 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("2t90804h") + .setVersion("dnbhc7fy") .addBearerAuth() .build(); From ba5988f49998908c8195fa209ad5c95789924599 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:35:52 +0000 Subject: [PATCH 04/85] amplication --- apps/ecommerce-admin/.gitignore | 10 +- apps/ecommerce-admin/Dockerfile | 2 +- apps/ecommerce-admin/README.md | 47 +++++++ apps/ecommerce-admin/package.json | 2 +- apps/ecommerce-admin/public/index.html | 2 +- apps/ecommerce-admin/public/manifest.json | 4 +- apps/ecommerce-admin/src/App.tsx | 2 +- .../src/address/AddressTitle.ts | 2 +- .../src/customer/CustomerTitle.ts | 2 +- apps/ecommerce-admin/src/order/OrderTitle.ts | 2 +- .../src/product/ProductTitle.ts | 2 +- apps/ecommerce-admin/src/user/UserTitle.ts | 2 +- apps/ecommerce-server/.env | 4 +- apps/ecommerce-server/.gitignore | 5 +- apps/ecommerce-server/Dockerfile | 4 +- apps/ecommerce-server/README.md | 87 +++++++++++++ apps/ecommerce-server/docker-compose.yml | 6 +- apps/ecommerce-server/package.json | 2 +- .../src/address/address.service.ts | 2 +- .../src/address/base/Address.ts | 2 + .../src/address/base/AddressCreateInput.ts | 2 + .../src/address/base/AddressUpdateInput.ts | 2 + .../src/address/base/AddressWhereInput.ts | 2 + .../address/base/AddressWhereUniqueInput.ts | 2 + ...erCreateNestedManyWithoutAddressesInput.ts | 2 + ...CustomerUpdateManyWithoutAddressesInput.ts | 2 + .../src/address/base/address.module.base.ts | 10 +- .../src/address/base/address.service.base.ts | 2 +- apps/ecommerce-server/src/app.module.ts | 2 + apps/ecommerce-server/src/auth/UserInfo.ts | 2 +- .../src/auth/auth.service.spec.ts | 118 ++++++++++++++++++ .../src/auth/jwt/base/jwt.strategy.base.ts | 3 +- .../src/auth/password.service.spec.ts | 67 ++++++++++ .../src/customer/base/Customer.ts | 2 + .../src/customer/base/CustomerCreateInput.ts | 2 + .../src/customer/base/CustomerUpdateInput.ts | 2 + .../src/customer/base/CustomerWhereInput.ts | 2 + .../customer/base/CustomerWhereUniqueInput.ts | 2 + ...erCreateNestedManyWithoutCustomersInput.ts | 2 + .../OrderUpdateManyWithoutCustomersInput.ts | 2 + .../src/customer/base/customer.module.base.ts | 10 +- .../customer/base/customer.service.base.ts | 2 +- .../src/customer/customer.service.ts | 2 +- .../src/health/base/health.service.base.ts | 2 +- .../src/health/health.module.ts | 2 - .../src/health/health.service.ts | 2 +- apps/ecommerce-server/src/order/base/Order.ts | 2 + .../src/order/base/OrderCreateInput.ts | 2 + .../src/order/base/OrderUpdateInput.ts | 2 + .../src/order/base/OrderWhereInput.ts | 2 + .../src/order/base/OrderWhereUniqueInput.ts | 2 + .../src/order/base/order.module.base.ts | 10 +- .../src/order/base/order.service.base.ts | 2 +- .../src/order/order.service.ts | 2 +- apps/ecommerce-server/src/prisma.util.spec.ts | 23 ++++ .../src/prisma/prisma.module.ts | 9 ++ .../src/prisma/prisma.service.ts | 15 +++ ...derCreateNestedManyWithoutProductsInput.ts | 2 + .../OrderUpdateManyWithoutProductsInput.ts | 2 + .../src/product/base/Product.ts | 2 + .../src/product/base/ProductCreateInput.ts | 2 + .../src/product/base/ProductUpdateInput.ts | 2 + .../src/product/base/ProductWhereInput.ts | 2 + .../product/base/ProductWhereUniqueInput.ts | 2 + .../src/product/base/product.module.base.ts | 10 +- .../src/product/base/product.service.base.ts | 2 +- .../src/product/product.service.ts | 2 +- .../base/secretsManager.service.base.spec.ts | 39 ++++++ apps/ecommerce-server/src/swagger.ts | 6 +- .../tests/auth/basic/basic.strategy.spec.ts | 37 ++++++ .../src/tests/health/health.service.spec.ts | 36 ++++++ apps/ecommerce-server/src/types.ts | 2 +- apps/ecommerce-server/src/user/base/User.ts | 2 + .../src/user/base/UserCreateInput.ts | 2 + .../src/user/base/UserUpdateInput.ts | 2 + .../src/user/base/UserWhereInput.ts | 2 + .../src/user/base/UserWhereUniqueInput.ts | 2 + .../src/user/base/user.module.base.ts | 10 +- .../src/user/base/user.service.base.ts | 2 +- .../ecommerce-server/src/user/user.service.ts | 2 +- .../src/util/JsonNullableFilter.ts | 2 +- 81 files changed, 598 insertions(+), 88 deletions(-) create mode 100644 apps/ecommerce-admin/README.md create mode 100644 apps/ecommerce-server/README.md create mode 100644 apps/ecommerce-server/src/auth/auth.service.spec.ts create mode 100644 apps/ecommerce-server/src/auth/password.service.spec.ts create mode 100644 apps/ecommerce-server/src/prisma.util.spec.ts create mode 100644 apps/ecommerce-server/src/prisma/prisma.module.ts create mode 100644 apps/ecommerce-server/src/prisma/prisma.service.ts create mode 100644 apps/ecommerce-server/src/providers/secrets/base/secretsManager.service.base.spec.ts create mode 100644 apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts create mode 100644 apps/ecommerce-server/src/tests/health/health.service.spec.ts diff --git a/apps/ecommerce-admin/.gitignore b/apps/ecommerce-admin/.gitignore index 4d29575..590b2e0 100644 --- a/apps/ecommerce-admin/.gitignore +++ b/apps/ecommerce-admin/.gitignore @@ -1,23 +1,23 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - + # dependencies /node_modules /.pnp .pnp.js - + # testing /coverage - + # production /build - + # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local - + npm-debug.log* yarn-debug.log* yarn-error.log* diff --git a/apps/ecommerce-admin/Dockerfile b/apps/ecommerce-admin/Dockerfile index 0afde3f..9b14177 100644 --- a/apps/ecommerce-admin/Dockerfile +++ b/apps/ecommerce-admin/Dockerfile @@ -1,4 +1,4 @@ -FROM node:19.1 AS base +FROM node:18.12.1 AS base ARG REACT_APP_SERVER_URL diff --git a/apps/ecommerce-admin/README.md b/apps/ecommerce-admin/README.md new file mode 100644 index 0000000..a7da2ed --- /dev/null +++ b/apps/ecommerce-admin/README.md @@ -0,0 +1,47 @@ +# Amplication + +This app was generated with Amplication. +You can learn more in the [Amplication documentation](https://docs.amplication.com/guides/getting-started). + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), and built with [react-admin](https://marmelab.com/react-admin/) + +## Environment Variables + +| Environment | Description | Value | +| -------------------- | ------------------------------------------- | --------------------- | +| PORT | The port that the client UI is listening to | +| REACT_APP_SERVER_URL | Amplication Server URL | http://localhost:3000 | + +## Available Scripts + +In the `admin-ui` subdirectory, you can run: + +### `yarn start` + +Runs the app in development mode. + +Open [http://localhost:3001](http://localhost:3001) to view it in the browser. + +### `yarn test` + +Runs tests to make sure everything is working correctly. + +### `yarn build` + +Builds the app for production in the `build` folder. + +### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +Ejects the Create React App. [Click here for more info](https://create-react-app.dev/docs/available-scripts/#npm-run-eject). + +### `docker:build` + +Build the Admin-UI Docker image. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/apps/ecommerce-admin/package.json b/apps/ecommerce-admin/package.json index b78e429..909a162 100644 --- a/apps/ecommerce-admin/package.json +++ b/apps/ecommerce-admin/package.json @@ -1,5 +1,5 @@ { - "name": "@sample-service/admin", + "name": "@ecommerce/admin", "private": true, "dependencies": { "@apollo/client": "3.6.9", diff --git a/apps/ecommerce-admin/public/index.html b/apps/ecommerce-admin/public/index.html index da8a620..34119ff 100644 --- a/apps/ecommerce-admin/public/index.html +++ b/apps/ecommerce-admin/public/index.html @@ -21,7 +21,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - Sample service + ecommerce diff --git a/apps/ecommerce-admin/public/manifest.json b/apps/ecommerce-admin/public/manifest.json index a108a39..e2396b0 100644 --- a/apps/ecommerce-admin/public/manifest.json +++ b/apps/ecommerce-admin/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "Sample service", - "name": "Sample service", + "short_name": "ecommerce", + "name": "ecommerce", "icons": [ { "src": "favicon.ico", diff --git a/apps/ecommerce-admin/src/App.tsx b/apps/ecommerce-admin/src/App.tsx index bb46e7b..d188d69 100644 --- a/apps/ecommerce-admin/src/App.tsx +++ b/apps/ecommerce-admin/src/App.tsx @@ -44,7 +44,7 @@ const App = (): React.ReactElement => { return (
{ - return record.address_1 || record.id; + return record.address_1 || String(record.id); }; diff --git a/apps/ecommerce-admin/src/customer/CustomerTitle.ts b/apps/ecommerce-admin/src/customer/CustomerTitle.ts index 0527c29..9ff5646 100644 --- a/apps/ecommerce-admin/src/customer/CustomerTitle.ts +++ b/apps/ecommerce-admin/src/customer/CustomerTitle.ts @@ -3,5 +3,5 @@ import { Customer as TCustomer } from "../api/customer/Customer"; export const CUSTOMER_TITLE_FIELD = "firstName"; export const CustomerTitle = (record: TCustomer): string => { - return record.firstName || record.id; + return record.firstName || String(record.id); }; diff --git a/apps/ecommerce-admin/src/order/OrderTitle.ts b/apps/ecommerce-admin/src/order/OrderTitle.ts index 71b9151..6cdb6d3 100644 --- a/apps/ecommerce-admin/src/order/OrderTitle.ts +++ b/apps/ecommerce-admin/src/order/OrderTitle.ts @@ -3,5 +3,5 @@ import { Order as TOrder } from "../api/order/Order"; export const ORDER_TITLE_FIELD = "id"; export const OrderTitle = (record: TOrder): string => { - return record.id || record.id; + return record.id || String(record.id); }; diff --git a/apps/ecommerce-admin/src/product/ProductTitle.ts b/apps/ecommerce-admin/src/product/ProductTitle.ts index a4c4d98..eae102a 100644 --- a/apps/ecommerce-admin/src/product/ProductTitle.ts +++ b/apps/ecommerce-admin/src/product/ProductTitle.ts @@ -3,5 +3,5 @@ import { Product as TProduct } from "../api/product/Product"; export const PRODUCT_TITLE_FIELD = "name"; export const ProductTitle = (record: TProduct): string => { - return record.name || record.id; + return record.name || String(record.id); }; diff --git a/apps/ecommerce-admin/src/user/UserTitle.ts b/apps/ecommerce-admin/src/user/UserTitle.ts index 29c8719..6653b8c 100644 --- a/apps/ecommerce-admin/src/user/UserTitle.ts +++ b/apps/ecommerce-admin/src/user/UserTitle.ts @@ -3,5 +3,5 @@ import { User as TUser } from "../api/user/User"; export const USER_TITLE_FIELD = "firstName"; export const UserTitle = (record: TUser): string => { - return record.firstName || record.id; + return record.firstName || String(record.id); }; diff --git a/apps/ecommerce-server/.env b/apps/ecommerce-server/.env index 93e3235..f392474 100644 --- a/apps/ecommerce-server/.env +++ b/apps/ecommerce-server/.env @@ -9,5 +9,5 @@ DB_PORT=5432 DB_URL=postgres://admin:admin@localhost:5432 KAFKA_BROKERS=localhost:9092 KAFKA_ENABLE_SSL=false -KAFKA_CLIENT_ID=sample-service -KAFKA_GROUP_ID=sample-service \ No newline at end of file +KAFKA_CLIENT_ID=ecommerce +KAFKA_GROUP_ID=ecommerce \ No newline at end of file diff --git a/apps/ecommerce-server/.gitignore b/apps/ecommerce-server/.gitignore index b65b772..08c9980 100644 --- a/apps/ecommerce-server/.gitignore +++ b/apps/ecommerce-server/.gitignore @@ -1,6 +1,5 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - - + /node_modules /dist -.DS_Store \ No newline at end of file +.DS_Store diff --git a/apps/ecommerce-server/Dockerfile b/apps/ecommerce-server/Dockerfile index 586f38c..0a20053 100644 --- a/apps/ecommerce-server/Dockerfile +++ b/apps/ecommerce-server/Dockerfile @@ -1,4 +1,4 @@ -FROM node:19.1 AS base +FROM node:18.12.1 AS base WORKDIR /app @@ -14,7 +14,7 @@ COPY . . RUN npm run build -FROM node:19.1 AS prod +FROM node:18.12.1 AS prod WORKDIR /app diff --git a/apps/ecommerce-server/README.md b/apps/ecommerce-server/README.md new file mode 100644 index 0000000..a43c337 --- /dev/null +++ b/apps/ecommerce-server/README.md @@ -0,0 +1,87 @@ +# Getting started with your app + +## Available Scripts + +In the `server` subdirectory, you can run: + +### `npm start` + +Runs the app in development mode. +By default, it is accessible at http://localhost:3000 + +### `npm test` + +Runs tests. + +### `npm run build` + +Builds the app for production in the `dist` folder. + +Your app is ready to be deployed! + +## Environment Variables: + +| Environment | Description | Value | +| -------------------- | ---------------------------------------- | ---------------------------------------------------------- | +| DEBUG_MODE | Debug level | 1 | +| DB_URL | Local database connection URL | db-provider://admin:admin@localhost:${DB_PORT}/\${DB_NAME} | +| DB_PORT | Local database port | | +| DB_USER | Local database username | admin | +| DB_PASSWORD | Local database password | admin | +| COMPOSE_PROJECT_NAME | Docker Compose project name | amp\_{applicationId} | +| SERVER_PORT | The port that the server is listening to | 3000 | +| JWT_SECRET_KEY | JWT secret | Change_ME!!! | +| JWT_EXPIRATION | JWT expiration in days | 2d | + +\*db-provider - the prisma DB provider (for example: for postgres is postgresql and for MySQL is mysql) + +## Getting Started - Local Development + +### Prerequisites + +Make sure you have Node.js 16.x, npm, and Docker installed. + +### Install dependencies + +In the `server` subdirectory, run: + +```console +cd server +npm install +``` + +### Generate Prisma client + +```console +npm run prisma:generate +``` + +### Start database using Docker + +```console +npm run docker:db +``` + +### Initialize the database + +```console +npm run db:init +``` + +### Start the server + +```console +npm start +``` + +## Getting Started - Docker Compose + +In the `server` subdirectory, run: + +```console +npm run compose:up +``` + +## Learn more + +You can learn more in the [Amplication documentation](https://docs.amplication.com/guides/getting-started). diff --git a/apps/ecommerce-server/docker-compose.yml b/apps/ecommerce-server/docker-compose.yml index 4636550..bbfcf67 100644 --- a/apps/ecommerce-server/docker-compose.yml +++ b/apps/ecommerce-server/docker-compose.yml @@ -11,7 +11,7 @@ services: BCRYPT_SALT: ${BCRYPT_SALT} JWT_SECRET_KEY: ${JWT_SECRET_KEY} JWT_EXPIRATION: ${JWT_EXPIRATION} - DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:5433 + DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:${DB_PORT} depends_on: - migrate migrate: @@ -23,7 +23,7 @@ services: working_dir: /app/server environment: BCRYPT_SALT: ${BCRYPT_SALT} - DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:5432 + DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:${DB_PORT} depends_on: db: condition: service_healthy @@ -42,7 +42,7 @@ services: - pg_isready - -q - -d - - ${DB_DB_NAME} + - ${DB_NAME} - -U - ${DB_USER} timeout: 45s diff --git a/apps/ecommerce-server/package.json b/apps/ecommerce-server/package.json index 476e061..36f2c5a 100644 --- a/apps/ecommerce-server/package.json +++ b/apps/ecommerce-server/package.json @@ -1,5 +1,5 @@ { - "name": "@sample-service/server", + "name": "@ecommerce/server", "private": true, "scripts": { "start": "nest start", diff --git a/apps/ecommerce-server/src/address/address.service.ts b/apps/ecommerce-server/src/address/address.service.ts index 7e5cb30..9a1741e 100644 --- a/apps/ecommerce-server/src/address/address.service.ts +++ b/apps/ecommerce-server/src/address/address.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../prisma/prisma.service"; import { AddressServiceBase } from "./base/address.service.base"; @Injectable() diff --git a/apps/ecommerce-server/src/address/base/Address.ts b/apps/ecommerce-server/src/address/base/Address.ts index 5d7ed78..6fe123a 100644 --- a/apps/ecommerce-server/src/address/base/Address.ts +++ b/apps/ecommerce-server/src/address/base/Address.ts @@ -20,6 +20,7 @@ import { } from "class-validator"; import { Type } from "class-transformer"; import { Customer } from "../../customer/base/Customer"; + @ObjectType() class Address { @ApiProperty({ @@ -110,4 +111,5 @@ class Address { }) zip!: number | null; } + export { Address }; diff --git a/apps/ecommerce-server/src/address/base/AddressCreateInput.ts b/apps/ecommerce-server/src/address/base/AddressCreateInput.ts index 6e6c440..68f4f95 100644 --- a/apps/ecommerce-server/src/address/base/AddressCreateInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressCreateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, ValidateNested, IsInt } from "class-validator"; import { CustomerCreateNestedManyWithoutAddressesInput } from "./CustomerCreateNestedManyWithoutAddressesInput"; import { Type } from "class-transformer"; + @InputType() class AddressCreateInput { @ApiProperty({ @@ -83,4 +84,5 @@ class AddressCreateInput { }) zip?: number | null; } + export { AddressCreateInput }; diff --git a/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts b/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts index 4b7b69b..d261ec0 100644 --- a/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, ValidateNested, IsInt } from "class-validator"; import { CustomerUpdateManyWithoutAddressesInput } from "./CustomerUpdateManyWithoutAddressesInput"; import { Type } from "class-transformer"; + @InputType() class AddressUpdateInput { @ApiProperty({ @@ -83,4 +84,5 @@ class AddressUpdateInput { }) zip?: number | null; } + export { AddressUpdateInput }; diff --git a/apps/ecommerce-server/src/address/base/AddressWhereInput.ts b/apps/ecommerce-server/src/address/base/AddressWhereInput.ts index c925b69..b0e7cd6 100644 --- a/apps/ecommerce-server/src/address/base/AddressWhereInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressWhereInput.ts @@ -17,6 +17,7 @@ import { IsOptional, ValidateNested } from "class-validator"; import { CustomerListRelationFilter } from "../../customer/base/CustomerListRelationFilter"; import { StringFilter } from "../../util/StringFilter"; import { IntNullableFilter } from "../../util/IntNullableFilter"; + @InputType() class AddressWhereInput { @ApiProperty({ @@ -97,4 +98,5 @@ class AddressWhereInput { }) zip?: IntNullableFilter; } + export { AddressWhereInput }; diff --git a/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts b/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts index a5dc259..e117397 100644 --- a/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class AddressWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class AddressWhereUniqueInput { @Field(() => String) id!: string; } + export { AddressWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts b/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts index b4269a0..bad138f 100644 --- a/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts +++ b/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { CustomerWhereUniqueInput } from "../../customer/base/CustomerWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class CustomerCreateNestedManyWithoutAddressesInput { @Field(() => [CustomerWhereUniqueInput], { @@ -23,4 +24,5 @@ class CustomerCreateNestedManyWithoutAddressesInput { }) connect?: Array; } + export { CustomerCreateNestedManyWithoutAddressesInput }; diff --git a/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts b/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts index 14b30a5..98bbc5a 100644 --- a/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts +++ b/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { CustomerWhereUniqueInput } from "../../customer/base/CustomerWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class CustomerUpdateManyWithoutAddressesInput { @Field(() => [CustomerWhereUniqueInput], { @@ -41,4 +42,5 @@ class CustomerUpdateManyWithoutAddressesInput { }) set?: Array; } + export { CustomerUpdateManyWithoutAddressesInput }; diff --git a/apps/ecommerce-server/src/address/base/address.module.base.ts b/apps/ecommerce-server/src/address/base/address.module.base.ts index fa59248..9204e4d 100644 --- a/apps/ecommerce-server/src/address/base/address.module.base.ts +++ b/apps/ecommerce-server/src/address/base/address.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class AddressModuleBase {} diff --git a/apps/ecommerce-server/src/address/base/address.service.base.ts b/apps/ecommerce-server/src/address/base/address.service.base.ts index eef3d17..8863093 100644 --- a/apps/ecommerce-server/src/address/base/address.service.base.ts +++ b/apps/ecommerce-server/src/address/base/address.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, Address, Customer } from "@prisma/client"; export class AddressServiceBase { diff --git a/apps/ecommerce-server/src/app.module.ts b/apps/ecommerce-server/src/app.module.ts index 650ecbf..d66c15b 100644 --- a/apps/ecommerce-server/src/app.module.ts +++ b/apps/ecommerce-server/src/app.module.ts @@ -9,6 +9,7 @@ import { ProductModule } from "./product/product.module"; import { ACLModule } from "./auth/acl.module"; import { AuthModule } from "./auth/auth.module"; import { HealthModule } from "./health/health.module"; +import { PrismaModule } from "./prisma/prisma.module"; import { SecretsManagerModule } from "./providers/secrets/secretsManager.module"; import { KafkaModule } from "./kafka/kafka.module"; import { ConfigModule, ConfigService } from "@nestjs/config"; @@ -27,6 +28,7 @@ import { GraphQLModule } from "@nestjs/graphql"; ACLModule, AuthModule, HealthModule, + PrismaModule, SecretsManagerModule, KafkaModule, MorganModule, diff --git a/apps/ecommerce-server/src/auth/UserInfo.ts b/apps/ecommerce-server/src/auth/UserInfo.ts index f1b1d3c..ef61dc4 100644 --- a/apps/ecommerce-server/src/auth/UserInfo.ts +++ b/apps/ecommerce-server/src/auth/UserInfo.ts @@ -1,5 +1,5 @@ import { Field, ObjectType } from "@nestjs/graphql"; -import { User } from "../user/base/user"; +import { User } from "../user/base/User"; @ObjectType() export class UserInfo implements Partial { diff --git a/apps/ecommerce-server/src/auth/auth.service.spec.ts b/apps/ecommerce-server/src/auth/auth.service.spec.ts new file mode 100644 index 0000000..aaa68e4 --- /dev/null +++ b/apps/ecommerce-server/src/auth/auth.service.spec.ts @@ -0,0 +1,118 @@ +import { Test, TestingModule } from "@nestjs/testing"; +// @ts-ignore +// eslint-disable-next-line +import { UserService } from "../user/user.service"; +import { AuthService } from "./auth.service"; +import { Credentials } from "./Credentials"; +import { PasswordService } from "./password.service"; +// @ts-ignore +// eslint-disable-next-line +import { TokenService } from "./token.service"; +import { VALID_ID } from "../tests/auth/constants"; + +const VALID_CREDENTIALS: Credentials = { + username: "Valid User", + password: "Valid User Password", +}; +const INVALID_CREDENTIALS: Credentials = { + username: "Invalid User", + password: "Invalid User Password", +}; +const USER: any = { + ...VALID_CREDENTIALS, + createdAt: new Date(), + firstName: "ofek", + id: VALID_ID, + lastName: "gabay", + roles: ["admin"], + updatedAt: new Date(), +}; + +const SIGN_TOKEN = "SIGN_TOKEN"; + +const userService = { + findOne(args: { where: { username: string } }): any | null { + if (args.where.username === VALID_CREDENTIALS.username) { + return USER; + } + return null; + }, +}; + +const passwordService = { + compare(password: string, encrypted: string) { + return true; + }, +}; + +const tokenService = { + createToken(username: string, password: string) { + return SIGN_TOKEN; + }, +}; + +describe("AuthService", () => { + //ARRANGE + let service: AuthService; + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + { + provide: UserService, + useValue: userService, + }, + { + provide: PasswordService, + useValue: passwordService, + }, + { + provide: TokenService, + useValue: tokenService, + }, + AuthService, + ], + }).compile(); + + service = module.get(AuthService); + }); + + it("should be defined", () => { + expect(service).toBeDefined(); + }); + + describe("Testing the authService.validateUser()", () => { + it("should validate a valid user", async () => { + await expect( + service.validateUser( + VALID_CREDENTIALS.username, + VALID_CREDENTIALS.password + ) + ).resolves.toEqual({ + username: USER.username, + roles: USER.roles, + id: USER.id, + }); + }); + + it("should not validate a invalid user", async () => { + await expect( + service.validateUser( + INVALID_CREDENTIALS.username, + INVALID_CREDENTIALS.password + ) + ).resolves.toBe(null); + }); + }); + + describe("Testing the authService.login()", () => { + it("should return userInfo object for correct username and password", async () => { + const loginResult = await service.login(VALID_CREDENTIALS); + expect(loginResult).toEqual({ + username: USER.username, + roles: USER.roles, + accessToken: SIGN_TOKEN, + id: USER.id, + }); + }); + }); +}); diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/auth/password.service.spec.ts b/apps/ecommerce-server/src/auth/password.service.spec.ts new file mode 100644 index 0000000..72f21a9 --- /dev/null +++ b/apps/ecommerce-server/src/auth/password.service.spec.ts @@ -0,0 +1,67 @@ +import { ConfigService } from "@nestjs/config"; +import { Test, TestingModule } from "@nestjs/testing"; +import { PasswordService } from "./password.service"; +import * as bcrypt from "bcrypt"; + +const EXAMPLE_PASSWORD = "examplePassword"; +const EXAMPLE_HASHED_PASSWORD = "exampleHashedPassword"; + +const EXAMPLE_SALT_OR_ROUNDS = 1; + +const configServiceGetMock = jest.fn(() => { + return EXAMPLE_SALT_OR_ROUNDS; +}); + +jest.mock("bcrypt"); + +//@ts-ignore +bcrypt.hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); + +//@ts-ignore +bcrypt.compare.mockImplementation(async () => true); + +describe("PasswordService", () => { + let service: PasswordService; + + beforeEach(async () => { + jest.clearAllMocks(); + const module: TestingModule = await Test.createTestingModule({ + providers: [ + PasswordService, + { + provide: ConfigService, + useClass: jest.fn(() => ({ + get: configServiceGetMock, + })), + }, + ], + imports: [], + }).compile(); + + service = module.get(PasswordService); + }); + + it("should be defined", () => { + expect(service).toBeDefined(); + }); + + it("should have salt defined", () => { + expect(service.salt).toEqual(EXAMPLE_SALT_OR_ROUNDS); + }); + + it("should compare a password", async () => { + const args = { + password: EXAMPLE_PASSWORD, + hashedPassword: EXAMPLE_HASHED_PASSWORD, + }; + await expect( + service.compare(args.password, args.hashedPassword) + ).resolves.toEqual(true); + }); + + it("should hash a password", async () => { + await expect(service.hash(EXAMPLE_PASSWORD)).resolves.toEqual( + EXAMPLE_HASHED_PASSWORD + ); + }); +}); diff --git a/apps/ecommerce-server/src/customer/base/Customer.ts b/apps/ecommerce-server/src/customer/base/Customer.ts index cea2dde..3265ecc 100644 --- a/apps/ecommerce-server/src/customer/base/Customer.ts +++ b/apps/ecommerce-server/src/customer/base/Customer.ts @@ -15,6 +15,7 @@ import { Address } from "../../address/base/Address"; import { ValidateNested, IsOptional, IsDate, IsString } from "class-validator"; import { Type } from "class-transformer"; import { Order } from "../../order/base/Order"; + @ObjectType() class Customer { @ApiProperty({ @@ -103,4 +104,5 @@ class Customer { @Field(() => Date) updatedAt!: Date; } + export { Customer }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts b/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts index 4a52d91..743faa1 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts @@ -15,6 +15,7 @@ import { AddressWhereUniqueInput } from "../../address/base/AddressWhereUniqueIn import { ValidateNested, IsOptional, IsString } from "class-validator"; import { Type } from "class-transformer"; import { OrderCreateNestedManyWithoutCustomersInput } from "./OrderCreateNestedManyWithoutCustomersInput"; + @InputType() class CustomerCreateInput { @ApiProperty({ @@ -85,4 +86,5 @@ class CustomerCreateInput { }) phone?: string | null; } + export { CustomerCreateInput }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts b/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts index 3b980e1..0f339dc 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts @@ -15,6 +15,7 @@ import { AddressWhereUniqueInput } from "../../address/base/AddressWhereUniqueIn import { ValidateNested, IsOptional, IsString } from "class-validator"; import { Type } from "class-transformer"; import { OrderUpdateManyWithoutCustomersInput } from "./OrderUpdateManyWithoutCustomersInput"; + @InputType() class CustomerUpdateInput { @ApiProperty({ @@ -85,4 +86,5 @@ class CustomerUpdateInput { }) phone?: string | null; } + export { CustomerUpdateInput }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts b/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts index a29a7ea..6bbee20 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts @@ -17,6 +17,7 @@ import { Type } from "class-transformer"; import { StringNullableFilter } from "../../util/StringNullableFilter"; import { StringFilter } from "../../util/StringFilter"; import { OrderListRelationFilter } from "../../order/base/OrderListRelationFilter"; + @InputType() class CustomerWhereInput { @ApiProperty({ @@ -98,4 +99,5 @@ class CustomerWhereInput { }) phone?: StringNullableFilter; } + export { CustomerWhereInput }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts b/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts index 8d85c0a..c7a5b76 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class CustomerWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class CustomerWhereUniqueInput { @Field(() => String) id!: string; } + export { CustomerWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts b/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts index ba6ed32..3896d63 100644 --- a/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts +++ b/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { OrderWhereUniqueInput } from "../../order/base/OrderWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class OrderCreateNestedManyWithoutCustomersInput { @Field(() => [OrderWhereUniqueInput], { @@ -23,4 +24,5 @@ class OrderCreateNestedManyWithoutCustomersInput { }) connect?: Array; } + export { OrderCreateNestedManyWithoutCustomersInput }; diff --git a/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts b/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts index a92c4b4..7669675 100644 --- a/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts +++ b/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { OrderWhereUniqueInput } from "../../order/base/OrderWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class OrderUpdateManyWithoutCustomersInput { @Field(() => [OrderWhereUniqueInput], { @@ -41,4 +42,5 @@ class OrderUpdateManyWithoutCustomersInput { }) set?: Array; } + export { OrderUpdateManyWithoutCustomersInput }; diff --git a/apps/ecommerce-server/src/customer/base/customer.module.base.ts b/apps/ecommerce-server/src/customer/base/customer.module.base.ts index b5f2c07..3816731 100644 --- a/apps/ecommerce-server/src/customer/base/customer.module.base.ts +++ b/apps/ecommerce-server/src/customer/base/customer.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class CustomerModuleBase {} diff --git a/apps/ecommerce-server/src/customer/base/customer.service.base.ts b/apps/ecommerce-server/src/customer/base/customer.service.base.ts index e0a5671..a36898f 100644 --- a/apps/ecommerce-server/src/customer/base/customer.service.base.ts +++ b/apps/ecommerce-server/src/customer/base/customer.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, Customer, Order, Address } from "@prisma/client"; export class CustomerServiceBase { diff --git a/apps/ecommerce-server/src/customer/customer.service.ts b/apps/ecommerce-server/src/customer/customer.service.ts index 9144aeb..534d665 100644 --- a/apps/ecommerce-server/src/customer/customer.service.ts +++ b/apps/ecommerce-server/src/customer/customer.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../prisma/prisma.service"; import { CustomerServiceBase } from "./base/customer.service.base"; @Injectable() diff --git a/apps/ecommerce-server/src/health/base/health.service.base.ts b/apps/ecommerce-server/src/health/base/health.service.base.ts index 0db85da..49a93a5 100644 --- a/apps/ecommerce-server/src/health/base/health.service.base.ts +++ b/apps/ecommerce-server/src/health/base/health.service.base.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; @Injectable() export class HealthServiceBase { diff --git a/apps/ecommerce-server/src/health/health.module.ts b/apps/ecommerce-server/src/health/health.module.ts index 61044a5..39eff7f 100644 --- a/apps/ecommerce-server/src/health/health.module.ts +++ b/apps/ecommerce-server/src/health/health.module.ts @@ -1,10 +1,8 @@ import { Module } from "@nestjs/common"; -import { PrismaModule } from "nestjs-prisma"; import { HealthController } from "./health.controller"; import { HealthService } from "./health.service"; @Module({ - imports: [PrismaModule], controllers: [HealthController], providers: [HealthService], exports: [HealthService], diff --git a/apps/ecommerce-server/src/health/health.service.ts b/apps/ecommerce-server/src/health/health.service.ts index 257c180..44d9343 100644 --- a/apps/ecommerce-server/src/health/health.service.ts +++ b/apps/ecommerce-server/src/health/health.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../prisma/prisma.service"; import { HealthServiceBase } from "./base/health.service.base"; @Injectable() diff --git a/apps/ecommerce-server/src/order/base/Order.ts b/apps/ecommerce-server/src/order/base/Order.ts index c152121..708f5c6 100644 --- a/apps/ecommerce-server/src/order/base/Order.ts +++ b/apps/ecommerce-server/src/order/base/Order.ts @@ -22,6 +22,7 @@ import { import { Type } from "class-transformer"; import { Customer } from "../../customer/base/Customer"; import { Product } from "../../product/base/Product"; + @ObjectType() class Order { @ApiProperty({ @@ -99,4 +100,5 @@ class Order { @Field(() => Date) updatedAt!: Date; } + export { Order }; diff --git a/apps/ecommerce-server/src/order/base/OrderCreateInput.ts b/apps/ecommerce-server/src/order/base/OrderCreateInput.ts index 553a615..b0bbdf1 100644 --- a/apps/ecommerce-server/src/order/base/OrderCreateInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderCreateInput.ts @@ -15,6 +15,7 @@ import { CustomerWhereUniqueInput } from "../../customer/base/CustomerWhereUniqu import { ValidateNested, IsOptional, IsNumber, IsInt } from "class-validator"; import { Type } from "class-transformer"; import { ProductWhereUniqueInput } from "../../product/base/ProductWhereUniqueInput"; + @InputType() class OrderCreateInput { @ApiProperty({ @@ -74,4 +75,5 @@ class OrderCreateInput { }) totalPrice?: number | null; } + export { OrderCreateInput }; diff --git a/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts b/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts index c8431ca..007f95c 100644 --- a/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts @@ -15,6 +15,7 @@ import { CustomerWhereUniqueInput } from "../../customer/base/CustomerWhereUniqu import { ValidateNested, IsOptional, IsNumber, IsInt } from "class-validator"; import { Type } from "class-transformer"; import { ProductWhereUniqueInput } from "../../product/base/ProductWhereUniqueInput"; + @InputType() class OrderUpdateInput { @ApiProperty({ @@ -74,4 +75,5 @@ class OrderUpdateInput { }) totalPrice?: number | null; } + export { OrderUpdateInput }; diff --git a/apps/ecommerce-server/src/order/base/OrderWhereInput.ts b/apps/ecommerce-server/src/order/base/OrderWhereInput.ts index 9c8e16e..62b0a3f 100644 --- a/apps/ecommerce-server/src/order/base/OrderWhereInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderWhereInput.ts @@ -18,6 +18,7 @@ import { FloatNullableFilter } from "../../util/FloatNullableFilter"; import { StringFilter } from "../../util/StringFilter"; import { ProductWhereUniqueInput } from "../../product/base/ProductWhereUniqueInput"; import { IntNullableFilter } from "../../util/IntNullableFilter"; + @InputType() class OrderWhereInput { @ApiProperty({ @@ -88,4 +89,5 @@ class OrderWhereInput { }) totalPrice?: IntNullableFilter; } + export { OrderWhereInput }; diff --git a/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts b/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts index a561ad2..1991d03 100644 --- a/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class OrderWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class OrderWhereUniqueInput { @Field(() => String) id!: string; } + export { OrderWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/order/base/order.module.base.ts b/apps/ecommerce-server/src/order/base/order.module.base.ts index e1ac73c..6e3d1f3 100644 --- a/apps/ecommerce-server/src/order/base/order.module.base.ts +++ b/apps/ecommerce-server/src/order/base/order.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class OrderModuleBase {} diff --git a/apps/ecommerce-server/src/order/base/order.service.base.ts b/apps/ecommerce-server/src/order/base/order.service.base.ts index e2865dd..90ba44a 100644 --- a/apps/ecommerce-server/src/order/base/order.service.base.ts +++ b/apps/ecommerce-server/src/order/base/order.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, Order, Customer, Product } from "@prisma/client"; export class OrderServiceBase { diff --git a/apps/ecommerce-server/src/order/order.service.ts b/apps/ecommerce-server/src/order/order.service.ts index 600fa24..1a0b876 100644 --- a/apps/ecommerce-server/src/order/order.service.ts +++ b/apps/ecommerce-server/src/order/order.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../prisma/prisma.service"; import { OrderServiceBase } from "./base/order.service.base"; @Injectable() diff --git a/apps/ecommerce-server/src/prisma.util.spec.ts b/apps/ecommerce-server/src/prisma.util.spec.ts new file mode 100644 index 0000000..0aa308e --- /dev/null +++ b/apps/ecommerce-server/src/prisma.util.spec.ts @@ -0,0 +1,23 @@ +import { + isRecordNotFoundError, + PRISMA_QUERY_INTERPRETATION_ERROR, +} from "./prisma.util"; + +describe("isRecordNotFoundError", () => { + test("returns true for record not found error", () => { + expect( + isRecordNotFoundError( + Object.assign( + new Error(`Error occurred during query execution: + InterpretationError("Error for binding '0': RecordNotFound("Record to update not found.")")`), + { + code: PRISMA_QUERY_INTERPRETATION_ERROR, + } + ) + ) + ).toBe(true); + }); + test("returns false for any other error", () => { + expect(isRecordNotFoundError(new Error())).toBe(false); + }); +}); diff --git a/apps/ecommerce-server/src/prisma/prisma.module.ts b/apps/ecommerce-server/src/prisma/prisma.module.ts new file mode 100644 index 0000000..1edbf95 --- /dev/null +++ b/apps/ecommerce-server/src/prisma/prisma.module.ts @@ -0,0 +1,9 @@ +import { Global, Module } from "@nestjs/common"; +import { PrismaService } from "./prisma.service"; + +@Global() +@Module({ + providers: [PrismaService], + exports: [PrismaService], +}) +export class PrismaModule {} diff --git a/apps/ecommerce-server/src/prisma/prisma.service.ts b/apps/ecommerce-server/src/prisma/prisma.service.ts new file mode 100644 index 0000000..3fb4081 --- /dev/null +++ b/apps/ecommerce-server/src/prisma/prisma.service.ts @@ -0,0 +1,15 @@ +import { Injectable, OnModuleInit, INestApplication } 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(); + }); + } +} diff --git a/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts b/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts index ef46f05..cb48bcf 100644 --- a/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts +++ b/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { OrderWhereUniqueInput } from "../../order/base/OrderWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class OrderCreateNestedManyWithoutProductsInput { @Field(() => [OrderWhereUniqueInput], { @@ -23,4 +24,5 @@ class OrderCreateNestedManyWithoutProductsInput { }) connect?: Array; } + export { OrderCreateNestedManyWithoutProductsInput }; diff --git a/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts b/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts index 327aa38..70fa067 100644 --- a/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts +++ b/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { OrderWhereUniqueInput } from "../../order/base/OrderWhereUniqueInput"; import { ApiProperty } from "@nestjs/swagger"; + @InputType() class OrderUpdateManyWithoutProductsInput { @Field(() => [OrderWhereUniqueInput], { @@ -41,4 +42,5 @@ class OrderUpdateManyWithoutProductsInput { }) set?: Array; } + export { OrderUpdateManyWithoutProductsInput }; diff --git a/apps/ecommerce-server/src/product/base/Product.ts b/apps/ecommerce-server/src/product/base/Product.ts index 73fe968..4a3a8b0 100644 --- a/apps/ecommerce-server/src/product/base/Product.ts +++ b/apps/ecommerce-server/src/product/base/Product.ts @@ -20,6 +20,7 @@ import { } from "class-validator"; import { Type } from "class-transformer"; import { Order } from "../../order/base/Order"; + @ObjectType() class Product { @ApiProperty({ @@ -88,4 +89,5 @@ class Product { @Field(() => Date) updatedAt!: Date; } + export { Product }; diff --git a/apps/ecommerce-server/src/product/base/ProductCreateInput.ts b/apps/ecommerce-server/src/product/base/ProductCreateInput.ts index dc20215..e835912 100644 --- a/apps/ecommerce-server/src/product/base/ProductCreateInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductCreateInput.ts @@ -19,6 +19,7 @@ import { } from "class-validator"; import { OrderCreateNestedManyWithoutProductsInput } from "./OrderCreateNestedManyWithoutProductsInput"; import { Type } from "class-transformer"; + @InputType() class ProductCreateInput { @ApiProperty({ @@ -66,4 +67,5 @@ class ProductCreateInput { }) orders?: OrderCreateNestedManyWithoutProductsInput; } + export { ProductCreateInput }; diff --git a/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts b/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts index afe2d41..36f55d8 100644 --- a/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts @@ -19,6 +19,7 @@ import { } from "class-validator"; import { OrderUpdateManyWithoutProductsInput } from "./OrderUpdateManyWithoutProductsInput"; import { Type } from "class-transformer"; + @InputType() class ProductUpdateInput { @ApiProperty({ @@ -66,4 +67,5 @@ class ProductUpdateInput { }) orders?: OrderUpdateManyWithoutProductsInput; } + export { ProductUpdateInput }; diff --git a/apps/ecommerce-server/src/product/base/ProductWhereInput.ts b/apps/ecommerce-server/src/product/base/ProductWhereInput.ts index c401a47..32e3daf 100644 --- a/apps/ecommerce-server/src/product/base/ProductWhereInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductWhereInput.ts @@ -17,6 +17,7 @@ import { IsOptional, ValidateNested } from "class-validator"; import { StringFilter } from "../../util/StringFilter"; import { FloatNullableFilter } from "../../util/FloatNullableFilter"; import { OrderListRelationFilter } from "../../order/base/OrderListRelationFilter"; + @InputType() class ProductWhereInput { @ApiProperty({ @@ -75,4 +76,5 @@ class ProductWhereInput { }) orders?: OrderListRelationFilter; } + export { ProductWhereInput }; diff --git a/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts b/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts index 92c70da..674b62d 100644 --- a/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class ProductWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class ProductWhereUniqueInput { @Field(() => String) id!: string; } + export { ProductWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/product/base/product.module.base.ts b/apps/ecommerce-server/src/product/base/product.module.base.ts index f4d9fd5..0584450 100644 --- a/apps/ecommerce-server/src/product/base/product.module.base.ts +++ b/apps/ecommerce-server/src/product/base/product.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class ProductModuleBase {} diff --git a/apps/ecommerce-server/src/product/base/product.service.base.ts b/apps/ecommerce-server/src/product/base/product.service.base.ts index 1222642..d77272b 100644 --- a/apps/ecommerce-server/src/product/base/product.service.base.ts +++ b/apps/ecommerce-server/src/product/base/product.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, Product, Order } from "@prisma/client"; export class ProductServiceBase { diff --git a/apps/ecommerce-server/src/product/product.service.ts b/apps/ecommerce-server/src/product/product.service.ts index 20d07b3..9be8d4b 100644 --- a/apps/ecommerce-server/src/product/product.service.ts +++ b/apps/ecommerce-server/src/product/product.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../prisma/prisma.service"; import { ProductServiceBase } from "./base/product.service.base"; @Injectable() diff --git a/apps/ecommerce-server/src/providers/secrets/base/secretsManager.service.base.spec.ts b/apps/ecommerce-server/src/providers/secrets/base/secretsManager.service.base.spec.ts new file mode 100644 index 0000000..0b5a709 --- /dev/null +++ b/apps/ecommerce-server/src/providers/secrets/base/secretsManager.service.base.spec.ts @@ -0,0 +1,39 @@ +import { ConfigService } from "@nestjs/config"; +import { mock } from "jest-mock-extended"; +import { SecretsManagerServiceBase } from "./secretsManager.service.base"; + +describe("Testing the secrets manager base class", () => { + const SECRET_KEY = "SECRET_KEY"; + const SECRET_VALUE = "SECRET_VALUE"; + const configService = mock(); + const secretsManagerServiceBase = new SecretsManagerServiceBase( + configService + ); + beforeEach(() => { + configService.get.mockClear(); + }); + it("should return value from env", async () => { + //ARRANGE + configService.get.mockReturnValue(SECRET_VALUE); + //ACT + const result = await secretsManagerServiceBase.getSecret(SECRET_KEY); + //ASSERT + expect(result).toBe(SECRET_VALUE); + }); + it("should return null for unknown keys", async () => { + //ARRANGE + configService.get.mockReturnValue(undefined); + //ACT + const result = await secretsManagerServiceBase.getSecret(SECRET_KEY); + //ASSERT + expect(result).toBeNull(); + }); + it("should throw error if dont get key", () => { + //@ts-ignore + return expect(secretsManagerServiceBase.getSecret()).rejects.toThrow(); + }); + it("should throw an exeption if getting null key", () => { + //@ts-ignore + return expect(secretsManagerServiceBase.getSecret(null)).rejects.toThrow(); + }); +}); diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index f84a78f..d69dccc 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -3,11 +3,11 @@ import { DocumentBuilder, SwaggerCustomOptions } from "@nestjs/swagger"; export const swaggerPath = "api"; export const swaggerDocumentOptions = new DocumentBuilder() - .setTitle("Sample service") + .setTitle("ecommerce") .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("i30p1hpo") + .setVersion("ka3zq7bx") .addBearerAuth() .build(); @@ -17,5 +17,5 @@ export const swaggerSetupOptions: SwaggerCustomOptions = { }, customCssUrl: "../swagger/swagger.css", customfavIcon: "../swagger/favicon.png", - customSiteTitle: "Sample service", + customSiteTitle: "ecommerce", }; diff --git a/apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts b/apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts new file mode 100644 index 0000000..29ae042 --- /dev/null +++ b/apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts @@ -0,0 +1,37 @@ +import { UnauthorizedException } from "@nestjs/common"; +import { mock } from "jest-mock-extended"; +import { AuthService } from "../../../auth/auth.service"; +import { BasicStrategyBase } from "../../../auth/basic/base/basic.strategy.base"; +import { TEST_USER } from "../constants"; + +describe("Testing the basicStrategyBase.validate()", () => { + const TEST_PASSWORD = "gabay"; + const authService = mock(); + const basicStrategy = new BasicStrategyBase(authService); + beforeEach(() => { + authService.validateUser.mockClear(); + }); + beforeAll(() => { + //ARRANGE + authService.validateUser + .calledWith(TEST_USER.username, TEST_PASSWORD) + .mockReturnValue(Promise.resolve(TEST_USER)); + }); + it("should return the user", async () => { + //ACT + const result = await basicStrategy.validate( + TEST_USER.username, + TEST_PASSWORD + ); + //ASSERT + expect(result).toBe(TEST_USER); + }); + it("should throw error if there is not valid user", async () => { + //ARRANGE + authService.validateUser.mockReturnValue(Promise.resolve(null)); + //ACT + const result = basicStrategy.validate("noUsername", TEST_PASSWORD); + //ASSERT + return expect(result).rejects.toThrowError(UnauthorizedException); + }); +}); diff --git a/apps/ecommerce-server/src/tests/health/health.service.spec.ts b/apps/ecommerce-server/src/tests/health/health.service.spec.ts new file mode 100644 index 0000000..f7cd00b --- /dev/null +++ b/apps/ecommerce-server/src/tests/health/health.service.spec.ts @@ -0,0 +1,36 @@ +import { mock } from "jest-mock-extended"; +import { PrismaService } from "nestjs-prisma"; +import { HealthServiceBase } from "../../health/base/health.service.base"; + +describe("Testing the HealthServiceBase", () => { + //ARRANGE + let prismaService: PrismaService; + let healthServiceBase: HealthServiceBase; + + describe("Testing the isDbReady function in HealthServiceBase class", () => { + beforeEach(() => { + prismaService = mock(); + healthServiceBase = new HealthServiceBase(prismaService); + }); + it("should return true if allow connection to db", async () => { + //ARRANGE + prismaService.$queryRaw + //@ts-ignore + .mockReturnValue(Promise.resolve(true)); + //ACT + const response = await healthServiceBase.isDbReady(); + //ASSERT + expect(response).toBe(true); + }); + it("should return false if db is not available", async () => { + //ARRANGE + prismaService.$queryRaw + //@ts-ignore + .mockReturnValue(Promise.reject(false)); + //ACT + const response = await healthServiceBase.isDbReady(); + //ASSERT + expect(response).toBe(false); + }); + }); +}); diff --git a/apps/ecommerce-server/src/types.ts b/apps/ecommerce-server/src/types.ts index 16a8bd9..f762a5d 100644 --- a/apps/ecommerce-server/src/types.ts +++ b/apps/ecommerce-server/src/types.ts @@ -1,3 +1,3 @@ -import { JsonValue } from "type-fest"; +import type { JsonValue } from "type-fest"; export type InputJsonValue = Omit; diff --git a/apps/ecommerce-server/src/user/base/User.ts b/apps/ecommerce-server/src/user/base/User.ts index e9f87a5..29aaa2d 100644 --- a/apps/ecommerce-server/src/user/base/User.ts +++ b/apps/ecommerce-server/src/user/base/User.ts @@ -15,6 +15,7 @@ import { IsDate, IsString, IsOptional, IsJSON } from "class-validator"; import { Type } from "class-transformer"; import { GraphQLJSON } from "graphql-type-json"; import { JsonValue } from "type-fest"; + @ObjectType() class User { @ApiProperty({ @@ -78,4 +79,5 @@ class User { @Field(() => String) username!: string; } + export { User }; diff --git a/apps/ecommerce-server/src/user/base/UserCreateInput.ts b/apps/ecommerce-server/src/user/base/UserCreateInput.ts index 0be1f75..0e5ad32 100644 --- a/apps/ecommerce-server/src/user/base/UserCreateInput.ts +++ b/apps/ecommerce-server/src/user/base/UserCreateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, IsJSON } from "class-validator"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; + @InputType() class UserCreateInput { @ApiProperty({ @@ -61,4 +62,5 @@ class UserCreateInput { @Field(() => String) username!: string; } + export { UserCreateInput }; diff --git a/apps/ecommerce-server/src/user/base/UserUpdateInput.ts b/apps/ecommerce-server/src/user/base/UserUpdateInput.ts index 36115bf..73a0141 100644 --- a/apps/ecommerce-server/src/user/base/UserUpdateInput.ts +++ b/apps/ecommerce-server/src/user/base/UserUpdateInput.ts @@ -14,6 +14,7 @@ import { ApiProperty } from "@nestjs/swagger"; import { IsString, IsOptional, IsJSON } from "class-validator"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; + @InputType() class UserUpdateInput { @ApiProperty({ @@ -70,4 +71,5 @@ class UserUpdateInput { }) username?: string; } + export { UserUpdateInput }; diff --git a/apps/ecommerce-server/src/user/base/UserWhereInput.ts b/apps/ecommerce-server/src/user/base/UserWhereInput.ts index 1a8088c..fd59ab5 100644 --- a/apps/ecommerce-server/src/user/base/UserWhereInput.ts +++ b/apps/ecommerce-server/src/user/base/UserWhereInput.ts @@ -15,6 +15,7 @@ import { StringNullableFilter } from "../../util/StringNullableFilter"; import { Type } from "class-transformer"; import { IsOptional } from "class-validator"; import { StringFilter } from "../../util/StringFilter"; + @InputType() class UserWhereInput { @ApiProperty({ @@ -61,4 +62,5 @@ class UserWhereInput { }) username?: StringFilter; } + export { UserWhereInput }; diff --git a/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts b/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts index 648452d..c711460 100644 --- a/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts @@ -12,6 +12,7 @@ https://docs.amplication.com/how-to/custom-code import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsString } from "class-validator"; + @InputType() class UserWhereUniqueInput { @ApiProperty({ @@ -22,4 +23,5 @@ class UserWhereUniqueInput { @Field(() => String) id!: string; } + export { UserWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/user/base/user.module.base.ts b/apps/ecommerce-server/src/user/base/user.module.base.ts index 6dc8244..ed8ce8d 100644 --- a/apps/ecommerce-server/src/user/base/user.module.base.ts +++ b/apps/ecommerce-server/src/user/base/user.module.base.ts @@ -11,18 +11,12 @@ https://docs.amplication.com/how-to/custom-code */ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; -import { PrismaModule } from "nestjs-prisma"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; @Module({ - imports: [ - ACLModule, - forwardRef(() => AuthModule), - MorganModule, - PrismaModule, - ], + imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule, PrismaModule], + exports: [ACLModule, AuthModule, MorganModule], }) export class UserModuleBase {} diff --git a/apps/ecommerce-server/src/user/base/user.service.base.ts b/apps/ecommerce-server/src/user/base/user.service.base.ts index 37a98b0..89d81db 100644 --- a/apps/ecommerce-server/src/user/base/user.service.base.ts +++ b/apps/ecommerce-server/src/user/base/user.service.base.ts @@ -9,7 +9,7 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { Prisma, User } from "@prisma/client"; import { PasswordService } from "../../auth/password.service"; import { transformStringFieldUpdateInput } from "../../prisma.util"; diff --git a/apps/ecommerce-server/src/user/user.service.ts b/apps/ecommerce-server/src/user/user.service.ts index 2a0582e..2d7ade5 100644 --- a/apps/ecommerce-server/src/user/user.service.ts +++ b/apps/ecommerce-server/src/user/user.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@nestjs/common"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../prisma/prisma.service"; import { UserServiceBase } from "./base/user.service.base"; import { PasswordService } from "../auth/password.service"; diff --git a/apps/ecommerce-server/src/util/JsonNullableFilter.ts b/apps/ecommerce-server/src/util/JsonNullableFilter.ts index 2750eaf..3381d52 100644 --- a/apps/ecommerce-server/src/util/JsonNullableFilter.ts +++ b/apps/ecommerce-server/src/util/JsonNullableFilter.ts @@ -1,4 +1,4 @@ -import { JsonValue } from "type-fest"; +import type { JsonValue } from "type-fest"; import { Field, InputType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { IsOptional } from "class-validator"; From 37234064d1c9728b3557f69ff07316a7e9342398 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:36:38 +0000 Subject: [PATCH 05/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 7c37e2b..0fe4c64 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("dnbhc7fy") + .setVersion("9tfywdzq") .addBearerAuth() .build(); From 5192ca6c3de365178b94ddfe794f2336dd154ec9 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:36:47 +0000 Subject: [PATCH 06/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index d69dccc..171d05d 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("ka3zq7bx") + .setVersion("9tfywdzq") .addBearerAuth() .build(); From 61f34b699d94256befd85716514c8b924eb869e2 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:37:22 +0000 Subject: [PATCH 07/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 0fe4c64..b3494ee 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("9tfywdzq") + .setVersion("r6qvawrr") .addBearerAuth() .build(); From 3f594eaa8dced1b63dfbf9d9a80d342aa63b2517 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:39:15 +0000 Subject: [PATCH 08/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index b3494ee..ad5edfb 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("r6qvawrr") + .setVersion("rnx6i0l6") .addBearerAuth() .build(); From 0c9d8fb33346bf3a20630fb9122a18df9183289f Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:40:18 +0000 Subject: [PATCH 09/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index ad5edfb..2d69620 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("rnx6i0l6") + .setVersion("c24e3o0j") .addBearerAuth() .build(); From 66fa34506dc8d9bd0f336883d6b01455e87c326d Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:40:26 +0000 Subject: [PATCH 10/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 171d05d..5843777 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("9tfywdzq") + .setVersion("c24e3o0j") .addBearerAuth() .build(); From 2dd91525fc8bd5bcb1341aa47b14530e097f4761 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:40:31 +0000 Subject: [PATCH 11/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 2d69620..5e8d1dc 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("c24e3o0j") + .setVersion("67isjln9") .addBearerAuth() .build(); From 697e1f0ff53723e3b3be7f2eefb3e17b584c7a20 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:40:37 +0000 Subject: [PATCH 12/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 5e8d1dc..0db3217 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("67isjln9") + .setVersion("q6tqh7gy") .addBearerAuth() .build(); From 1a1b649098177eba451d942cb97c7451c7b87f3e Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:51:01 +0000 Subject: [PATCH 13/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 0db3217..eee3504 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("q6tqh7gy") + .setVersion("17f7m8ef") .addBearerAuth() .build(); From ace5ec31eb5a9497501690156d9139008e3f1b8d Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:59:32 +0000 Subject: [PATCH 14/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index eee3504..cc7c6ea 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("17f7m8ef") + .setVersion("qk63od6m") .addBearerAuth() .build(); From 6d65f04d9b6dc93797ecd5d0988d94b367ef2740 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:59:41 +0000 Subject: [PATCH 15/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 +-- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index 7766538..d7d7cb1 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 5843777..556fc32 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("c24e3o0j") + .setVersion("qk63od6m") .addBearerAuth() .build(); From 3fa3b78f28a72469b0fb831e9bc094e259e8619c Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 12:59:55 +0000 Subject: [PATCH 16/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index cc7c6ea..3e1ffd1 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("qk63od6m") + .setVersion("q4391bbk") .addBearerAuth() .build(); From 62bc50c2488faeea19449181fde265a19cfd6b02 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:00:05 +0000 Subject: [PATCH 17/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 ++- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 556fc32..314c50a 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("qk63od6m") + .setVersion("q4391bbk") .addBearerAuth() .build(); From 656936ac4a1980d08031970a601f93945f81cb65 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:00:26 +0000 Subject: [PATCH 18/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 3e1ffd1..b784057 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("q4391bbk") + .setVersion("7lxlqpow") .addBearerAuth() .build(); From abd0b46d8fb72934a0bb085d59f0c746818c54e8 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:00:35 +0000 Subject: [PATCH 19/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 314c50a..0397f74 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("q4391bbk") + .setVersion("7lxlqpow") .addBearerAuth() .build(); From e2ac7f7613c45c0efc772d19fe9e908af7b6f760 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:01:08 +0000 Subject: [PATCH 20/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index b784057..56e2e0d 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("7lxlqpow") + .setVersion("bm8sigm7") .addBearerAuth() .build(); From 57dcb9eaf0b66040311f85d33b73f226209d582c Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:01:15 +0000 Subject: [PATCH 21/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 0397f74..3d9c06e 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("7lxlqpow") + .setVersion("bm8sigm7") .addBearerAuth() .build(); From 4e62d230cdb97e074a3d10b975d84ef1d67a19e5 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:01:21 +0000 Subject: [PATCH 22/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 56e2e0d..d58000c 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("bm8sigm7") + .setVersion("d80zss07") .addBearerAuth() .build(); From 5e1069368fd28a03e4b294dcf53dbea2dd5bdf24 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:01:29 +0000 Subject: [PATCH 23/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 3d9c06e..48f3aaa 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("bm8sigm7") + .setVersion("d80zss07") .addBearerAuth() .build(); From 97d9af92511fa4c037b234d071262df531f349f3 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:02:02 +0000 Subject: [PATCH 24/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index d58000c..2f16c11 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("d80zss07") + .setVersion("ntqxvhh9") .addBearerAuth() .build(); From d6b65073880a58a0344d60209c97fb139c0f96aa Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:02:14 +0000 Subject: [PATCH 25/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 48f3aaa..5ab83dc 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("d80zss07") + .setVersion("ntqxvhh9") .addBearerAuth() .build(); From 4345e69d654ede1337e5f4609a83ded388934893 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:05:25 +0000 Subject: [PATCH 26/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 2f16c11..b45fc3e 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("ntqxvhh9") + .setVersion("77x0jenf") .addBearerAuth() .build(); From 23ba059f9b66d36d4d3cd603c550284e0b11269a Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:05:44 +0000 Subject: [PATCH 27/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 5ab83dc..597ea8b 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("ntqxvhh9") + .setVersion("77x0jenf") .addBearerAuth() .build(); From c9536732e58f49ebf18637d3f2f78dd4bb810673 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:15:19 +0000 Subject: [PATCH 28/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index b45fc3e..23e65c0 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("77x0jenf") + .setVersion("6gn8em50") .addBearerAuth() .build(); From e8c3b2b0ff41f64c90c36c8c6a28251fb927122c Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:15:31 +0000 Subject: [PATCH 29/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 597ea8b..44873d4 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("77x0jenf") + .setVersion("6gn8em50") .addBearerAuth() .build(); From 5980419d635e4f4fa463d07e704de2ea396030d8 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:16:07 +0000 Subject: [PATCH 30/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 23e65c0..682f5e4 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("6gn8em50") + .setVersion("nmjtjcp3") .addBearerAuth() .build(); From 5e343e7bc4098463f28f092eaf404113a1cac7aa Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:16:16 +0000 Subject: [PATCH 31/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 44873d4..ef86d92 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("6gn8em50") + .setVersion("nmjtjcp3") .addBearerAuth() .build(); From 62863aa0ddc423979753e2945b71e6515d49fd49 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:17:08 +0000 Subject: [PATCH 32/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 682f5e4..331de2d 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("nmjtjcp3") + .setVersion("w2e68nel") .addBearerAuth() .build(); From 693dd1b1b6c34bb55b03917151d9853738bf3600 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:17:15 +0000 Subject: [PATCH 33/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 +-- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index 7766538..d7d7cb1 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index ef86d92..f844097 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("nmjtjcp3") + .setVersion("w2e68nel") .addBearerAuth() .build(); From 5a04856d0b59312347228692ab0d5ffe6c8fd266 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:17:54 +0000 Subject: [PATCH 34/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 331de2d..e263c5b 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("w2e68nel") + .setVersion("ixpo3dwh") .addBearerAuth() .build(); From 9f454755d1c68afdb1d4e964a4dcf6f6809aa771 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:18:03 +0000 Subject: [PATCH 35/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 ++- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index f844097..fe55da3 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("w2e68nel") + .setVersion("ixpo3dwh") .addBearerAuth() .build(); From fb8a84f6ac37fbe7424858127040a13595effdf0 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 14:25:22 +0000 Subject: [PATCH 36/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index fe55da3..53dd739 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("ixpo3dwh") + .setVersion("eipdd06k") .addBearerAuth() .build(); From 9a7325ea91c468fdab4041c57d626798eea43802 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 14:36:58 +0000 Subject: [PATCH 37/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 53dd739..0c7af2d 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("eipdd06k") + .setVersion("b4opzpp6") .addBearerAuth() .build(); From affa9446cb5c4919031a36f8f924b3381359ee06 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 14:53:07 +0000 Subject: [PATCH 38/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 0c7af2d..d692540 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("b4opzpp6") + .setVersion("3el4sdog") .addBearerAuth() .build(); From 41ba49d0bfade726ca108a90b6a1b60304714a4f Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 14:53:14 +0000 Subject: [PATCH 39/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index e263c5b..64fab49 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("ixpo3dwh") + .setVersion("hfj14gpw") .addBearerAuth() .build(); From da470445944b9d9b522d4ac8beae108d3b4e7a93 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:04:55 +0000 Subject: [PATCH 40/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 64fab49..fab85d0 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("hfj14gpw") + .setVersion("291mw14q") .addBearerAuth() .build(); From e83368172ee883ad0192bcc720fc3ee2afd3f1db Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:05:00 +0000 Subject: [PATCH 41/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index fab85d0..4a80cc5 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("291mw14q") + .setVersion("gn53ux26") .addBearerAuth() .build(); From 2ce5d392dc45d274ef669baedba365d24aeb66db Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:05:07 +0000 Subject: [PATCH 42/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index d692540..f1e73a8 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("3el4sdog") + .setVersion("gn53ux26") .addBearerAuth() .build(); From d298b3ce37ed3e400eb6ea065f6102ba4d22d401 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:13:30 +0000 Subject: [PATCH 43/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 4a80cc5..73da30e 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("gn53ux26") + .setVersion("e28eu2wu") .addBearerAuth() .build(); From dec264a4473bfe48bdd542dfce11fc7b1e638a93 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:13:39 +0000 Subject: [PATCH 44/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index f1e73a8..0481751 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("gn53ux26") + .setVersion("e28eu2wu") .addBearerAuth() .build(); From 435f7605aa7d46e9f55e8fdd83319a8124eac804 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:15:05 +0000 Subject: [PATCH 45/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 73da30e..5f38fc3 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("e28eu2wu") + .setVersion("1kjj52xf") .addBearerAuth() .build(); From 847555121bfb9a524b587fde6ec2f35e86b9c255 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:15:14 +0000 Subject: [PATCH 46/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 0481751..b17bd8e 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("e28eu2wu") + .setVersion("1kjj52xf") .addBearerAuth() .build(); From e0b4713f8c20849c74b810f25c0f0a90f2b26cdf Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:15:20 +0000 Subject: [PATCH 47/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 5f38fc3..7208c65 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("1kjj52xf") + .setVersion("ocli2kn7") .addBearerAuth() .build(); From 23a0154d3391bda2e6f6390cc739ec0571f4ba92 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:15:25 +0000 Subject: [PATCH 48/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 7208c65..3c75ad0 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("ocli2kn7") + .setVersion("1cactb3h") .addBearerAuth() .build(); From 33cf8f52645927330f26a6715a43a7adf74d8b92 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:15:31 +0000 Subject: [PATCH 49/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index b17bd8e..5f8d40f 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("1kjj52xf") + .setVersion("1cactb3h") .addBearerAuth() .build(); From ba9870f736aaad9f015ecbeabffda750b0c1319b Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:15:36 +0000 Subject: [PATCH 50/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 5f8d40f..bb6a7af 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("1cactb3h") + .setVersion("ocli2kn7") .addBearerAuth() .build(); From 8a7b51666c5991d1e952aaeed0445b8967d37e52 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:20:20 +0000 Subject: [PATCH 51/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 3c75ad0..f45a735 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("1cactb3h") + .setVersion("u69kss8c") .addBearerAuth() .build(); From c291945d0e7298df8312406fb78773abf14321cd Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:20:30 +0000 Subject: [PATCH 52/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index bb6a7af..e5b439f 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("ocli2kn7") + .setVersion("u69kss8c") .addBearerAuth() .build(); From c471f0321acac9d54926a7f544649db9d5b7742a Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:33:32 +0000 Subject: [PATCH 53/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index f45a735..af44aa2 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("u69kss8c") + .setVersion("b2ev08f4") .addBearerAuth() .build(); From aa20e0b39dd75c43f35619d4cbedf4b204181447 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:34:18 +0000 Subject: [PATCH 54/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index af44aa2..3afd9e8 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("b2ev08f4") + .setVersion("1h9tbvrq") .addBearerAuth() .build(); From 4efe0405fbab4659fa7c9da979054a4bc55ea14c Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:34:24 +0000 Subject: [PATCH 55/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 3afd9e8..6ab0108 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("1h9tbvrq") + .setVersion("k09zlon1") .addBearerAuth() .build(); From fab1268998d9e5b2724a2734bdd4e7761670e239 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:34:32 +0000 Subject: [PATCH 56/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 6ab0108..d256567 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("k09zlon1") + .setVersion("o09vu2lp") .addBearerAuth() .build(); From 32dd55e61662c25e96a3e5076d0fb719b8dd99c0 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:34:38 +0000 Subject: [PATCH 57/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 +-- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index 7766538..d7d7cb1 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index e5b439f..d0a32e3 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("u69kss8c") + .setVersion("k09zlon1") .addBearerAuth() .build(); From e28be8bbed136a39506315e2af652fd0cd6a9c95 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:34:44 +0000 Subject: [PATCH 58/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 ++- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index d0a32e3..339102f 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("k09zlon1") + .setVersion("o09vu2lp") .addBearerAuth() .build(); From 61db3068e779515c46407398b5f80934cbd3be55 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 16:44:23 +0000 Subject: [PATCH 59/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index d256567..211b2ff 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("o09vu2lp") + .setVersion("smdb37er") .addBearerAuth() .build(); From 3f73498f5bcfb92c70c5ec19c8d4794b1212e885 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 16:44:32 +0000 Subject: [PATCH 60/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 +-- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index 7766538..d7d7cb1 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 339102f..5f7411e 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("o09vu2lp") + .setVersion("smdb37er") .addBearerAuth() .build(); From 3a20db11a71f012d584e5652e0169f3dc08b2100 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sat, 14 Jan 2023 16:52:03 +0000 Subject: [PATCH 61/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 ++- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 5f7411e..36b0695 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("smdb37er") + .setVersion("rgouhbxn") .addBearerAuth() .build(); From d30decdf1c40f1b96e7137160418ca684943c119 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 07:07:26 +0000 Subject: [PATCH 62/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 36b0695..57e076c 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("rgouhbxn") + .setVersion("vnrt40ir") .addBearerAuth() .build(); From 851d124dbb6a64020983c72a215fb441beae13e3 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:07:48 +0000 Subject: [PATCH 63/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 211b2ff..40b5c1c 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("smdb37er") + .setVersion("93l6rpqw") .addBearerAuth() .build(); From 64d864f0b97c2554d0250bf175d894f5d05f7f0d Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:08:01 +0000 Subject: [PATCH 64/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 57e076c..6a1b613 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("vnrt40ir") + .setVersion("93l6rpqw") .addBearerAuth() .build(); From 1b266fc2d303f072e9d32ef7c00c53fde151c334 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:12:22 +0000 Subject: [PATCH 65/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 40b5c1c..9561024 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("93l6rpqw") + .setVersion("wcwabum1") .addBearerAuth() .build(); From d013c7717a95f7f4b4bbe4ff0cee1188b152e662 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:12:31 +0000 Subject: [PATCH 66/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 +-- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index 7766538..d7d7cb1 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 6a1b613..8004883 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("93l6rpqw") + .setVersion("wcwabum1") .addBearerAuth() .build(); From ebc26df8ef79f45f41c959949d6a7bda08adec02 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:14:29 +0000 Subject: [PATCH 67/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 +-- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index e138356..72537e5 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 9561024..b44667d 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("wcwabum1") + .setVersion("3fw4p8kq") .addBearerAuth() .build(); From 721d85b191fe27377f6c56b495eeacb22ef5c3fa Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:14:38 +0000 Subject: [PATCH 68/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 ++- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 8004883..971e5f5 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("wcwabum1") + .setVersion("3fw4p8kq") .addBearerAuth() .build(); From c9555c4face21bf59728e4b09a7a2c8b0c78b14a Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:04:23 +0000 Subject: [PATCH 69/85] amplication --- .../logistic-server/src/auth/basic/base/basic.strategy.base.ts | 3 ++- apps/logistic-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts index 72537e5..e138356 100644 --- a/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts +++ b/apps/logistic-server/src/auth/basic/base/basic.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class BasicStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor(protected readonly authService: AuthService) { super(); } diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index b44667d..69a2f22 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("3fw4p8kq") + .setVersion("5537ca9f") .addBearerAuth() .build(); From 24913237be61de2392a6ed35fbcacd7d70b67467 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:04:40 +0000 Subject: [PATCH 70/85] amplication --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 971e5f5..defb52a 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("3fw4p8kq") + .setVersion("5537ca9f") .addBearerAuth() .build(); From a339730bb75a502dcec2e912a3f4c37d5089fe2c Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:06:41 +0000 Subject: [PATCH 71/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 69a2f22..6218954 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("5537ca9f") + .setVersion("cvc7p3hv") .addBearerAuth() .build(); From bb062e1259f65ac9f9712a3eee09900f1ffd1f1f Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:06:48 +0000 Subject: [PATCH 72/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 +-- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index 7766538..d7d7cb1 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index defb52a..ef25b58 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("5537ca9f") + .setVersion("cvc7p3hv") .addBearerAuth() .build(); From f26930c735663b2e2a15cc06e8ff8f814cb2c956 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:07:31 +0000 Subject: [PATCH 73/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 ++- apps/ecommerce-server/src/swagger.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index ef25b58..6b65714 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("cvc7p3hv") + .setVersion("rpo0hlek") .addBearerAuth() .build(); From 357f89b8c6b71a637d2e8fbecbdb0aa32c8b7ac4 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:07:57 +0000 Subject: [PATCH 74/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 6218954..6a3f8a3 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("cvc7p3hv") + .setVersion("rpo0hlek") .addBearerAuth() .build(); From d447e25fb0f8d9777ce87886978c07ddd11bd5a5 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 15:08:02 +0000 Subject: [PATCH 75/85] amplication From 135eaf82004e84eb78bff6ae3e714321a8bcc92f Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 09:08:16 +0000 Subject: [PATCH 76/85] amplication --- apps/logistic-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 6a3f8a3..8c02e3f 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("rpo0hlek") + .setVersion("9qih46fr") .addBearerAuth() .build(); From 82d61704378acf2cbaea398110774040700d5ef4 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 09:08:30 +0000 Subject: [PATCH 77/85] amplication --- apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts | 3 +-- apps/ecommerce-server/src/auth/jwt/jwt.strategy.ts | 1 + apps/ecommerce-server/src/swagger.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index 7766538..d7d7cb1 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,8 +7,7 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy -{ + implements IAuthStrategy { constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/auth/jwt/jwt.strategy.ts b/apps/ecommerce-server/src/auth/jwt/jwt.strategy.ts index 0de5def..0794650 100644 --- a/apps/ecommerce-server/src/auth/jwt/jwt.strategy.ts +++ b/apps/ecommerce-server/src/auth/jwt/jwt.strategy.ts @@ -2,6 +2,7 @@ import { Inject, Injectable } from "@nestjs/common"; import { JWT_SECRET_KEY } from "../../constants"; import { UserService } from "../../user/user.service"; import { JwtStrategyBase } from "./base/jwt.strategy.base"; + @Injectable() export class JwtStrategy extends JwtStrategyBase { constructor( diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index 6b65714..c1994ee 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("rpo0hlek") + .setVersion("9qih46fr") .addBearerAuth() .build(); From 133af8e6b34295f4d85dcdbe7635083b9c805429 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Tue, 21 Feb 2023 18:12:05 +0000 Subject: [PATCH 78/85] Amplication build # cleekcisz01x4iu01z5z50768. Commit message: https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbozbamx00noj301wjlnxivl/builds/cleekcisz01x4iu01z5z50768 --- apps/logistic-server/.env | 6 +- apps/logistic-server/package.json | 7 +- apps/logistic-server/scripts/seed.ts | 11 +++- apps/logistic-server/src/app.module.ts | 10 +-- .../src/auth/jwt/base/jwt.strategy.base.ts | 40 ------------ .../src/auth/jwt/jwt.strategy.ts | 13 ---- .../src/auth/jwt/jwtAuth.guard.ts | 3 - .../src/auth/jwt/jwtSecretFactory.ts | 16 ----- .../src/auth/password.service.spec.ts | 2 - .../src/auth/userData.decorator.ts | 1 - apps/logistic-server/src/grants.json | 2 +- .../src/shipment/base/CreateShipmentArgs.ts | 2 +- .../src/shipment/base/DeleteShipmentArgs.ts | 2 +- .../src/shipment/base/Shipment.ts | 2 +- .../src/shipment/base/ShipmentCreateInput.ts | 2 +- .../src/shipment/base/ShipmentFindManyArgs.ts | 2 +- .../shipment/base/ShipmentFindUniqueArgs.ts | 2 +- .../base/ShipmentListRelationFilter.ts | 2 +- .../src/shipment/base/ShipmentOrderByInput.ts | 2 +- .../src/shipment/base/ShipmentUpdateInput.ts | 2 +- .../src/shipment/base/ShipmentWhereInput.ts | 2 +- .../shipment/base/ShipmentWhereUniqueInput.ts | 2 +- .../src/shipment/base/UpdateShipmentArgs.ts | 2 +- ...seCreateNestedManyWithoutShipmentsInput.ts | 2 +- ...arehouseUpdateManyWithoutShipmentsInput.ts | 2 +- .../shipment/base/shipment.controller.base.ts | 64 +++++++++++-------- .../src/shipment/base/shipment.module.base.ts | 2 - apps/logistic-server/src/swagger.ts | 2 +- .../src/tests/auth/jwt/jwt.strategy.spec.ts | 27 -------- .../src/user/base/CreateUserArgs.ts | 2 +- .../src/user/base/DeleteUserArgs.ts | 2 +- .../src/user/base/UpdateUserArgs.ts | 2 +- apps/logistic-server/src/user/base/User.ts | 2 +- .../src/user/base/UserCreateInput.ts | 2 +- .../src/user/base/UserFindManyArgs.ts | 2 +- .../src/user/base/UserFindUniqueArgs.ts | 2 +- .../src/user/base/UserListRelationFilter.ts | 2 +- .../src/user/base/UserOrderByInput.ts | 2 +- .../src/user/base/UserUpdateInput.ts | 2 +- .../src/user/base/UserWhereInput.ts | 2 +- .../src/user/base/UserWhereUniqueInput.ts | 2 +- .../src/user/base/user.controller.base.ts | 54 +++++++++------- .../src/user/base/user.module.base.ts | 2 - .../src/warehouse/base/CreateWarehouseArgs.ts | 2 +- .../src/warehouse/base/DeleteWarehouseArgs.ts | 2 +- ...tCreateNestedManyWithoutWarehousesInput.ts | 2 +- ...hipmentUpdateManyWithoutWarehousesInput.ts | 2 +- .../src/warehouse/base/UpdateWarehouseArgs.ts | 2 +- .../src/warehouse/base/Warehouse.ts | 2 +- .../warehouse/base/WarehouseCreateInput.ts | 2 +- .../warehouse/base/WarehouseFindManyArgs.ts | 2 +- .../warehouse/base/WarehouseFindUniqueArgs.ts | 2 +- .../base/WarehouseListRelationFilter.ts | 2 +- .../warehouse/base/WarehouseOrderByInput.ts | 2 +- .../warehouse/base/WarehouseUpdateInput.ts | 2 +- .../src/warehouse/base/WarehouseWhereInput.ts | 2 +- .../base/WarehouseWhereUniqueInput.ts | 2 +- .../base/warehouse.controller.base.ts | 64 +++++++++++-------- .../warehouse/base/warehouse.module.base.ts | 2 - 59 files changed, 167 insertions(+), 241 deletions(-) delete mode 100644 apps/logistic-server/src/auth/jwt/base/jwt.strategy.base.ts delete mode 100644 apps/logistic-server/src/auth/jwt/jwt.strategy.ts delete mode 100644 apps/logistic-server/src/auth/jwt/jwtAuth.guard.ts delete mode 100644 apps/logistic-server/src/auth/jwt/jwtSecretFactory.ts delete mode 100644 apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts diff --git a/apps/logistic-server/.env b/apps/logistic-server/.env index b8d09a0..40b1072 100644 --- a/apps/logistic-server/.env +++ b/apps/logistic-server/.env @@ -1,7 +1,5 @@ BCRYPT_SALT=10 COMPOSE_PROJECT_NAME=amp_clbozbamx00noj301wjlnxivl -JWT_SECRET_KEY=Change_ME!!! -JWT_EXPIRATION=2d PORT=3000 DB_USER=root DB_PASSWORD=admin @@ -10,4 +8,6 @@ DB_URL=mysql://root:admin@localhost:3306/logistic KAFKA_BROKERS=localhost:9092 KAFKA_ENABLE_SSL=false KAFKA_CLIENT_ID=logistic -KAFKA_GROUP_ID=logistic \ No newline at end of file +KAFKA_GROUP_ID=logistic +JWT_SECRET_KEY=Change_ME!!! +JWT_EXPIRATION=2d \ No newline at end of file diff --git a/apps/logistic-server/package.json b/apps/logistic-server/package.json index 6cca8f5..c479b39 100644 --- a/apps/logistic-server/package.json +++ b/apps/logistic-server/package.json @@ -1,5 +1,6 @@ { - "name": "@logistic/server", + "name": "@sample-application/server", + "version": "0.1.3", "private": true, "scripts": { "start": "nest start", @@ -44,9 +45,7 @@ "passport-jwt": "4.0.0", "reflect-metadata": "0.1.13", "swagger-ui-express": "4.3.0", - "ts-node": "9.1.1", - "@nestjs/microservices": "8.2.3", - "kafkajs": "2.2.0" + "ts-node": "9.1.1" }, "devDependencies": { "@nestjs/cli": "8.2.5", diff --git a/apps/logistic-server/scripts/seed.ts b/apps/logistic-server/scripts/seed.ts index 3bb4d3a..272dddd 100644 --- a/apps/logistic-server/scripts/seed.ts +++ b/apps/logistic-server/scripts/seed.ts @@ -1,8 +1,8 @@ import * as dotenv from "dotenv"; import { PrismaClient } from "@prisma/client"; +import { customSeed } from "./customSeed"; import { Salt, parseSalt } from "../src/auth/password.service"; import { hash } from "bcrypt"; -import { customSeed } from "./customSeed"; if (require.main === module) { dotenv.config(); @@ -12,7 +12,6 @@ if (require.main === module) { if (!BCRYPT_SALT) { throw new Error("BCRYPT_SALT environment variable must be defined"); } - const salt = parseSalt(BCRYPT_SALT); seed(salt).catch((error) => { @@ -25,16 +24,22 @@ async function seed(bcryptSalt: Salt) { console.info("Seeding database..."); const client = new PrismaClient(); + const data = { username: "admin", password: await hash("admin", bcryptSalt), roles: ["user"], }; + await client.user.upsert({ - where: { username: data.username }, + where: { + username: data.username, + }, + update: {}, create: data, }); + void client.$disconnect(); console.info("Seeding database with custom seed..."); diff --git a/apps/logistic-server/src/app.module.ts b/apps/logistic-server/src/app.module.ts index 9a4b843..7735924 100644 --- a/apps/logistic-server/src/app.module.ts +++ b/apps/logistic-server/src/app.module.ts @@ -4,8 +4,6 @@ import { MorganInterceptor, MorganModule } from "nest-morgan"; import { UserModule } from "./user/user.module"; import { WarehouseModule } from "./warehouse/warehouse.module"; import { ShipmentModule } from "./shipment/shipment.module"; -import { ACLModule } from "./auth/acl.module"; -import { AuthModule } from "./auth/auth.module"; import { HealthModule } from "./health/health.module"; import { PrismaModule } from "./prisma/prisma.module"; import { SecretsManagerModule } from "./providers/secrets/secretsManager.module"; @@ -15,18 +13,20 @@ import { ServeStaticModule } from "@nestjs/serve-static"; import { ServeStaticOptionsService } from "./serveStaticOptions.service"; import { GraphQLModule } from "@nestjs/graphql"; +import { ACLModule } from "./auth/acl.module"; +import { AuthModule } from "./auth/auth.module"; + @Module({ controllers: [], imports: [ + ACLModule, + AuthModule, UserModule, WarehouseModule, ShipmentModule, - ACLModule, - AuthModule, HealthModule, PrismaModule, SecretsManagerModule, - KafkaModule, MorganModule, ConfigModule.forRoot({ isGlobal: true }), ServeStaticModule.forRootAsync({ diff --git a/apps/logistic-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/logistic-server/src/auth/jwt/base/jwt.strategy.base.ts deleted file mode 100644 index 7766538..0000000 --- a/apps/logistic-server/src/auth/jwt/base/jwt.strategy.base.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { UnauthorizedException } from "@nestjs/common"; -import { PassportStrategy } from "@nestjs/passport"; -import { ExtractJwt, Strategy } from "passport-jwt"; -import { IAuthStrategy } from "../../IAuthStrategy"; -import { UserService } from "../../../user/user.service"; -import { UserInfo } from "../../UserInfo"; - -export class JwtStrategyBase - extends PassportStrategy(Strategy) - implements IAuthStrategy -{ - constructor( - protected readonly userService: UserService, - protected readonly secretOrKey: string - ) { - super({ - jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), - ignoreExpiration: false, - secretOrKey, - }); - } - - async validate(payload: UserInfo): Promise { - const { username } = payload; - const user = await this.userService.findOne({ - where: { username }, - }); - if (!user) { - throw new UnauthorizedException(); - } - if ( - !Array.isArray(user.roles) || - typeof user.roles !== "object" || - user.roles === null - ) { - throw new Error("User roles is not a valid value"); - } - return { ...user, roles: user.roles as string[] }; - } -} diff --git a/apps/logistic-server/src/auth/jwt/jwt.strategy.ts b/apps/logistic-server/src/auth/jwt/jwt.strategy.ts deleted file mode 100644 index 0de5def..0000000 --- a/apps/logistic-server/src/auth/jwt/jwt.strategy.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Inject, Injectable } from "@nestjs/common"; -import { JWT_SECRET_KEY } from "../../constants"; -import { UserService } from "../../user/user.service"; -import { JwtStrategyBase } from "./base/jwt.strategy.base"; -@Injectable() -export class JwtStrategy extends JwtStrategyBase { - constructor( - protected readonly userService: UserService, - @Inject(JWT_SECRET_KEY) secretOrKey: string - ) { - super(userService, secretOrKey); - } -} diff --git a/apps/logistic-server/src/auth/jwt/jwtAuth.guard.ts b/apps/logistic-server/src/auth/jwt/jwtAuth.guard.ts deleted file mode 100644 index f0c5570..0000000 --- a/apps/logistic-server/src/auth/jwt/jwtAuth.guard.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { AuthGuard } from "@nestjs/passport"; - -export class JwtAuthGuard extends AuthGuard("jwt") {} diff --git a/apps/logistic-server/src/auth/jwt/jwtSecretFactory.ts b/apps/logistic-server/src/auth/jwt/jwtSecretFactory.ts deleted file mode 100644 index 151e793..0000000 --- a/apps/logistic-server/src/auth/jwt/jwtSecretFactory.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { JWT_SECRET_KEY } from "../../constants"; -import { SecretsManagerService } from "../../providers/secrets/secretsManager.service"; - -export const jwtSecretFactory = { - provide: JWT_SECRET_KEY, - useFactory: async ( - secretsService: SecretsManagerService - ): Promise => { - const secret = await secretsService.getSecret(JWT_SECRET_KEY); - if (secret) { - return secret; - } - throw new Error("jwtSecretFactory missing secret"); - }, - inject: [SecretsManagerService], -}; diff --git a/apps/logistic-server/src/auth/password.service.spec.ts b/apps/logistic-server/src/auth/password.service.spec.ts index 72f21a9..79c5a44 100644 --- a/apps/logistic-server/src/auth/password.service.spec.ts +++ b/apps/logistic-server/src/auth/password.service.spec.ts @@ -14,10 +14,8 @@ const configServiceGetMock = jest.fn(() => { jest.mock("bcrypt"); -//@ts-ignore bcrypt.hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); -//@ts-ignore bcrypt.compare.mockImplementation(async () => true); describe("PasswordService", () => { diff --git a/apps/logistic-server/src/auth/userData.decorator.ts b/apps/logistic-server/src/auth/userData.decorator.ts index 240c7d9..6a40ad1 100644 --- a/apps/logistic-server/src/auth/userData.decorator.ts +++ b/apps/logistic-server/src/auth/userData.decorator.ts @@ -1,6 +1,5 @@ import { createParamDecorator, ExecutionContext } from "@nestjs/common"; import { GqlContextType, GqlExecutionContext } from "@nestjs/graphql"; -//@ts-ignore import { User } from "@prisma/client"; /** diff --git a/apps/logistic-server/src/grants.json b/apps/logistic-server/src/grants.json index ab6870b..854274c 100644 --- a/apps/logistic-server/src/grants.json +++ b/apps/logistic-server/src/grants.json @@ -89,4 +89,4 @@ "action": "read:any", "attributes": "*" } -] \ No newline at end of file +] diff --git a/apps/logistic-server/src/shipment/base/CreateShipmentArgs.ts b/apps/logistic-server/src/shipment/base/CreateShipmentArgs.ts index 31a3bcb..9357ff6 100644 --- a/apps/logistic-server/src/shipment/base/CreateShipmentArgs.ts +++ b/apps/logistic-server/src/shipment/base/CreateShipmentArgs.ts @@ -18,4 +18,4 @@ class CreateShipmentArgs { data!: ShipmentCreateInput; } -export { CreateShipmentArgs }; +export { CreateShipmentArgs as CreateShipmentArgs }; diff --git a/apps/logistic-server/src/shipment/base/DeleteShipmentArgs.ts b/apps/logistic-server/src/shipment/base/DeleteShipmentArgs.ts index 8ce4974..457386a 100644 --- a/apps/logistic-server/src/shipment/base/DeleteShipmentArgs.ts +++ b/apps/logistic-server/src/shipment/base/DeleteShipmentArgs.ts @@ -18,4 +18,4 @@ class DeleteShipmentArgs { where!: ShipmentWhereUniqueInput; } -export { DeleteShipmentArgs }; +export { DeleteShipmentArgs as DeleteShipmentArgs }; diff --git a/apps/logistic-server/src/shipment/base/Shipment.ts b/apps/logistic-server/src/shipment/base/Shipment.ts index a1444cb..2856179 100644 --- a/apps/logistic-server/src/shipment/base/Shipment.ts +++ b/apps/logistic-server/src/shipment/base/Shipment.ts @@ -62,4 +62,4 @@ class Shipment { warehouse?: Array; } -export { Shipment }; +export { Shipment as Shipment }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts b/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts index a4d3770..dbe1786 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentCreateInput.ts @@ -41,4 +41,4 @@ class ShipmentCreateInput { warehouse?: WarehouseCreateNestedManyWithoutShipmentsInput; } -export { ShipmentCreateInput }; +export { ShipmentCreateInput as ShipmentCreateInput }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentFindManyArgs.ts b/apps/logistic-server/src/shipment/base/ShipmentFindManyArgs.ts index 5095195..a249cd3 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentFindManyArgs.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentFindManyArgs.ts @@ -50,4 +50,4 @@ class ShipmentFindManyArgs { take?: number; } -export { ShipmentFindManyArgs }; +export { ShipmentFindManyArgs as ShipmentFindManyArgs }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentFindUniqueArgs.ts b/apps/logistic-server/src/shipment/base/ShipmentFindUniqueArgs.ts index d2e43fc..5751d54 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentFindUniqueArgs.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentFindUniqueArgs.ts @@ -18,4 +18,4 @@ class ShipmentFindUniqueArgs { where!: ShipmentWhereUniqueInput; } -export { ShipmentFindUniqueArgs }; +export { ShipmentFindUniqueArgs as ShipmentFindUniqueArgs }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentListRelationFilter.ts b/apps/logistic-server/src/shipment/base/ShipmentListRelationFilter.ts index 0d864b6..4485a77 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentListRelationFilter.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentListRelationFilter.ts @@ -53,4 +53,4 @@ class ShipmentListRelationFilter { }) none?: ShipmentWhereInput; } -export { ShipmentListRelationFilter }; +export { ShipmentListRelationFilter as ShipmentListRelationFilter }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentOrderByInput.ts b/apps/logistic-server/src/shipment/base/ShipmentOrderByInput.ts index c82d15c..2c5d2af 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentOrderByInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentOrderByInput.ts @@ -55,4 +55,4 @@ class ShipmentOrderByInput { updatedAt?: SortOrder; } -export { ShipmentOrderByInput }; +export { ShipmentOrderByInput as ShipmentOrderByInput }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts b/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts index e67a968..63bf3b9 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentUpdateInput.ts @@ -41,4 +41,4 @@ class ShipmentUpdateInput { warehouse?: WarehouseUpdateManyWithoutShipmentsInput; } -export { ShipmentUpdateInput }; +export { ShipmentUpdateInput as ShipmentUpdateInput }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts b/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts index d02d196..f2e5b5d 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentWhereInput.ts @@ -54,4 +54,4 @@ class ShipmentWhereInput { warehouse?: WarehouseListRelationFilter; } -export { ShipmentWhereInput }; +export { ShipmentWhereInput as ShipmentWhereInput }; diff --git a/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts b/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts index 80ea33d..50820fe 100644 --- a/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts +++ b/apps/logistic-server/src/shipment/base/ShipmentWhereUniqueInput.ts @@ -24,4 +24,4 @@ class ShipmentWhereUniqueInput { id!: string; } -export { ShipmentWhereUniqueInput }; +export { ShipmentWhereUniqueInput as ShipmentWhereUniqueInput }; diff --git a/apps/logistic-server/src/shipment/base/UpdateShipmentArgs.ts b/apps/logistic-server/src/shipment/base/UpdateShipmentArgs.ts index afd8554..28e1bca 100644 --- a/apps/logistic-server/src/shipment/base/UpdateShipmentArgs.ts +++ b/apps/logistic-server/src/shipment/base/UpdateShipmentArgs.ts @@ -21,4 +21,4 @@ class UpdateShipmentArgs { data!: ShipmentUpdateInput; } -export { UpdateShipmentArgs }; +export { UpdateShipmentArgs as UpdateShipmentArgs }; diff --git a/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts b/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts index fa66aeb..5543f73 100644 --- a/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts +++ b/apps/logistic-server/src/shipment/base/WarehouseCreateNestedManyWithoutShipmentsInput.ts @@ -25,4 +25,4 @@ class WarehouseCreateNestedManyWithoutShipmentsInput { connect?: Array; } -export { WarehouseCreateNestedManyWithoutShipmentsInput }; +export { WarehouseCreateNestedManyWithoutShipmentsInput as WarehouseCreateNestedManyWithoutShipmentsInput }; diff --git a/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts b/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts index bc73a6b..06c63ea 100644 --- a/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts +++ b/apps/logistic-server/src/shipment/base/WarehouseUpdateManyWithoutShipmentsInput.ts @@ -43,4 +43,4 @@ class WarehouseUpdateManyWithoutShipmentsInput { set?: Array; } -export { WarehouseUpdateManyWithoutShipmentsInput }; +export { WarehouseUpdateManyWithoutShipmentsInput as WarehouseUpdateManyWithoutShipmentsInput }; diff --git a/apps/logistic-server/src/shipment/base/shipment.controller.base.ts b/apps/logistic-server/src/shipment/base/shipment.controller.base.ts index bcef170..52e26ff 100644 --- a/apps/logistic-server/src/shipment/base/shipment.controller.base.ts +++ b/apps/logistic-server/src/shipment/base/shipment.controller.base.ts @@ -11,13 +11,13 @@ https://docs.amplication.com/how-to/custom-code */ import * as common from "@nestjs/common"; import * as swagger from "@nestjs/swagger"; -import * as nestAccessControl from "nest-access-control"; -import * as defaultAuthGuard from "../../auth/defaultAuth.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import * as errors from "../../errors"; import { Request } from "express"; import { plainToClass } from "class-transformer"; import { ApiNestedQuery } from "../../decorators/api-nested-query.decorator"; +import * as nestAccessControl from "nest-access-control"; +import * as defaultAuthGuard from "../../auth/defaultAuth.guard"; import { ShipmentService } from "../shipment.service"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; @@ -30,6 +30,7 @@ import { Shipment } from "./Shipment"; import { WarehouseFindManyArgs } from "../../warehouse/base/WarehouseFindManyArgs"; import { Warehouse } from "../../warehouse/base/Warehouse"; import { WarehouseWhereUniqueInput } from "../../warehouse/base/WarehouseWhereUniqueInput"; + @swagger.ApiBearerAuth() @common.UseGuards(defaultAuthGuard.DefaultAuthGuard, nestAccessControl.ACGuard) export class ShipmentControllerBase { @@ -37,16 +38,17 @@ export class ShipmentControllerBase { protected readonly service: ShipmentService, protected readonly rolesBuilder: nestAccessControl.RolesBuilder ) {} - @common.UseInterceptors(AclValidateRequestInterceptor) + @common.Post() + @swagger.ApiCreatedResponse({ type: Shipment }) @nestAccessControl.UseRoles({ resource: "Shipment", action: "create", possession: "any", }) - @common.Post() - @swagger.ApiCreatedResponse({ type: Shipment }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async create(@common.Body() data: ShipmentCreateInput): Promise { return await this.service.create({ data: data, @@ -60,15 +62,17 @@ export class ShipmentControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get() + @swagger.ApiOkResponse({ type: [Shipment] }) + @ApiNestedQuery(ShipmentFindManyArgs) @nestAccessControl.UseRoles({ resource: "Shipment", action: "read", possession: "any", }) - @common.Get() - @swagger.ApiOkResponse({ type: [Shipment] }) - @swagger.ApiForbiddenResponse() - @ApiNestedQuery(ShipmentFindManyArgs) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async findMany(@common.Req() request: Request): Promise { const args = plainToClass(ShipmentFindManyArgs, request.query); return this.service.findMany({ @@ -83,15 +87,17 @@ export class ShipmentControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get("/:id") + @swagger.ApiOkResponse({ type: Shipment }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "Shipment", action: "read", possession: "own", }) - @common.Get("/:id") - @swagger.ApiOkResponse({ type: Shipment }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async findOne( @common.Param() params: ShipmentWhereUniqueInput ): Promise { @@ -113,15 +119,17 @@ export class ShipmentControllerBase { } @common.UseInterceptors(AclValidateRequestInterceptor) + @common.Patch("/:id") + @swagger.ApiOkResponse({ type: Shipment }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "Shipment", action: "update", possession: "any", }) - @common.Patch("/:id") - @swagger.ApiOkResponse({ type: Shipment }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async update( @common.Param() params: ShipmentWhereUniqueInput, @common.Body() data: ShipmentUpdateInput @@ -147,15 +155,17 @@ export class ShipmentControllerBase { } } + @common.Delete("/:id") + @swagger.ApiOkResponse({ type: Shipment }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "Shipment", action: "delete", possession: "any", }) - @common.Delete("/:id") - @swagger.ApiOkResponse({ type: Shipment }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async delete( @common.Param() params: ShipmentWhereUniqueInput ): Promise { @@ -180,13 +190,13 @@ export class ShipmentControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get("/:id/warehouse") + @ApiNestedQuery(WarehouseFindManyArgs) @nestAccessControl.UseRoles({ resource: "Warehouse", action: "read", possession: "any", }) - @common.Get("/:id/warehouse") - @ApiNestedQuery(WarehouseFindManyArgs) async findManyWarehouse( @common.Req() request: Request, @common.Param() params: ShipmentWhereUniqueInput @@ -210,12 +220,12 @@ export class ShipmentControllerBase { return results; } + @common.Post("/:id/warehouse") @nestAccessControl.UseRoles({ resource: "Shipment", action: "update", possession: "any", }) - @common.Post("/:id/warehouse") async connectWarehouse( @common.Param() params: ShipmentWhereUniqueInput, @common.Body() body: WarehouseWhereUniqueInput[] @@ -232,12 +242,12 @@ export class ShipmentControllerBase { }); } + @common.Patch("/:id/warehouse") @nestAccessControl.UseRoles({ resource: "Shipment", action: "update", possession: "any", }) - @common.Patch("/:id/warehouse") async updateWarehouse( @common.Param() params: ShipmentWhereUniqueInput, @common.Body() body: WarehouseWhereUniqueInput[] @@ -254,12 +264,12 @@ export class ShipmentControllerBase { }); } + @common.Delete("/:id/warehouse") @nestAccessControl.UseRoles({ resource: "Shipment", action: "update", possession: "any", }) - @common.Delete("/:id/warehouse") async disconnectWarehouse( @common.Param() params: ShipmentWhereUniqueInput, @common.Body() body: WarehouseWhereUniqueInput[] diff --git a/apps/logistic-server/src/shipment/base/shipment.module.base.ts b/apps/logistic-server/src/shipment/base/shipment.module.base.ts index d5bd55c..994e027 100644 --- a/apps/logistic-server/src/shipment/base/shipment.module.base.ts +++ b/apps/logistic-server/src/shipment/base/shipment.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class ShipmentModuleBase {} diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 8c02e3f..71ef2ac 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("9qih46fr") + .setVersion("nqy7krj5") .addBearerAuth() .build(); diff --git a/apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts b/apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts deleted file mode 100644 index cc701e1..0000000 --- a/apps/logistic-server/src/tests/auth/jwt/jwt.strategy.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { UnauthorizedException } from "@nestjs/common"; -import { mock } from "jest-mock-extended"; -import { JwtStrategyBase } from "../../../auth/jwt/base/jwt.strategy.base"; -import { UserService } from "../../../user/user.service"; -import { TEST_USER } from "../constants"; - -describe("Testing the jwtStrategyBase.validate()", () => { - const userService = mock(); - const jwtStrategy = new JwtStrategyBase(userService, "Secrete"); - beforeEach(() => { - userService.findOne.mockClear(); - }); - it("should throw UnauthorizedException where there is no user", async () => { - //ARRANGE - userService.findOne - .calledWith({ where: { username: TEST_USER.username } }) - .mockReturnValue(Promise.resolve(null)); - //ACT - const result = jwtStrategy.validate({ - id: TEST_USER.id, - username: TEST_USER.username, - roles: TEST_USER.roles, - }); - //ASSERT - return expect(result).rejects.toThrowError(UnauthorizedException); - }); -}); diff --git a/apps/logistic-server/src/user/base/CreateUserArgs.ts b/apps/logistic-server/src/user/base/CreateUserArgs.ts index 4a1e644..24817ac 100644 --- a/apps/logistic-server/src/user/base/CreateUserArgs.ts +++ b/apps/logistic-server/src/user/base/CreateUserArgs.ts @@ -18,4 +18,4 @@ class CreateUserArgs { data!: UserCreateInput; } -export { CreateUserArgs }; +export { CreateUserArgs as CreateUserArgs }; diff --git a/apps/logistic-server/src/user/base/DeleteUserArgs.ts b/apps/logistic-server/src/user/base/DeleteUserArgs.ts index ec845b0..3649def 100644 --- a/apps/logistic-server/src/user/base/DeleteUserArgs.ts +++ b/apps/logistic-server/src/user/base/DeleteUserArgs.ts @@ -18,4 +18,4 @@ class DeleteUserArgs { where!: UserWhereUniqueInput; } -export { DeleteUserArgs }; +export { DeleteUserArgs as DeleteUserArgs }; diff --git a/apps/logistic-server/src/user/base/UpdateUserArgs.ts b/apps/logistic-server/src/user/base/UpdateUserArgs.ts index d2f133f..342f128 100644 --- a/apps/logistic-server/src/user/base/UpdateUserArgs.ts +++ b/apps/logistic-server/src/user/base/UpdateUserArgs.ts @@ -21,4 +21,4 @@ class UpdateUserArgs { data!: UserUpdateInput; } -export { UpdateUserArgs }; +export { UpdateUserArgs as UpdateUserArgs }; diff --git a/apps/logistic-server/src/user/base/User.ts b/apps/logistic-server/src/user/base/User.ts index 29aaa2d..0050859 100644 --- a/apps/logistic-server/src/user/base/User.ts +++ b/apps/logistic-server/src/user/base/User.ts @@ -80,4 +80,4 @@ class User { username!: string; } -export { User }; +export { User as User }; diff --git a/apps/logistic-server/src/user/base/UserCreateInput.ts b/apps/logistic-server/src/user/base/UserCreateInput.ts index 0e5ad32..adba25b 100644 --- a/apps/logistic-server/src/user/base/UserCreateInput.ts +++ b/apps/logistic-server/src/user/base/UserCreateInput.ts @@ -63,4 +63,4 @@ class UserCreateInput { username!: string; } -export { UserCreateInput }; +export { UserCreateInput as UserCreateInput }; diff --git a/apps/logistic-server/src/user/base/UserFindManyArgs.ts b/apps/logistic-server/src/user/base/UserFindManyArgs.ts index 07ffdab..11525da 100644 --- a/apps/logistic-server/src/user/base/UserFindManyArgs.ts +++ b/apps/logistic-server/src/user/base/UserFindManyArgs.ts @@ -50,4 +50,4 @@ class UserFindManyArgs { take?: number; } -export { UserFindManyArgs }; +export { UserFindManyArgs as UserFindManyArgs }; diff --git a/apps/logistic-server/src/user/base/UserFindUniqueArgs.ts b/apps/logistic-server/src/user/base/UserFindUniqueArgs.ts index 3767539..b7810d2 100644 --- a/apps/logistic-server/src/user/base/UserFindUniqueArgs.ts +++ b/apps/logistic-server/src/user/base/UserFindUniqueArgs.ts @@ -18,4 +18,4 @@ class UserFindUniqueArgs { where!: UserWhereUniqueInput; } -export { UserFindUniqueArgs }; +export { UserFindUniqueArgs as UserFindUniqueArgs }; diff --git a/apps/logistic-server/src/user/base/UserListRelationFilter.ts b/apps/logistic-server/src/user/base/UserListRelationFilter.ts index 4c57721..0ff7d94 100644 --- a/apps/logistic-server/src/user/base/UserListRelationFilter.ts +++ b/apps/logistic-server/src/user/base/UserListRelationFilter.ts @@ -53,4 +53,4 @@ class UserListRelationFilter { }) none?: UserWhereInput; } -export { UserListRelationFilter }; +export { UserListRelationFilter as UserListRelationFilter }; diff --git a/apps/logistic-server/src/user/base/UserOrderByInput.ts b/apps/logistic-server/src/user/base/UserOrderByInput.ts index 07baa8d..849a0c3 100644 --- a/apps/logistic-server/src/user/base/UserOrderByInput.ts +++ b/apps/logistic-server/src/user/base/UserOrderByInput.ts @@ -91,4 +91,4 @@ class UserOrderByInput { username?: SortOrder; } -export { UserOrderByInput }; +export { UserOrderByInput as UserOrderByInput }; diff --git a/apps/logistic-server/src/user/base/UserUpdateInput.ts b/apps/logistic-server/src/user/base/UserUpdateInput.ts index 73a0141..5e77d9f 100644 --- a/apps/logistic-server/src/user/base/UserUpdateInput.ts +++ b/apps/logistic-server/src/user/base/UserUpdateInput.ts @@ -72,4 +72,4 @@ class UserUpdateInput { username?: string; } -export { UserUpdateInput }; +export { UserUpdateInput as UserUpdateInput }; diff --git a/apps/logistic-server/src/user/base/UserWhereInput.ts b/apps/logistic-server/src/user/base/UserWhereInput.ts index fd59ab5..a8babc1 100644 --- a/apps/logistic-server/src/user/base/UserWhereInput.ts +++ b/apps/logistic-server/src/user/base/UserWhereInput.ts @@ -63,4 +63,4 @@ class UserWhereInput { username?: StringFilter; } -export { UserWhereInput }; +export { UserWhereInput as UserWhereInput }; diff --git a/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts b/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts index c711460..0bcea12 100644 --- a/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts +++ b/apps/logistic-server/src/user/base/UserWhereUniqueInput.ts @@ -24,4 +24,4 @@ class UserWhereUniqueInput { id!: string; } -export { UserWhereUniqueInput }; +export { UserWhereUniqueInput as UserWhereUniqueInput }; diff --git a/apps/logistic-server/src/user/base/user.controller.base.ts b/apps/logistic-server/src/user/base/user.controller.base.ts index 8d7e987..0a05e44 100644 --- a/apps/logistic-server/src/user/base/user.controller.base.ts +++ b/apps/logistic-server/src/user/base/user.controller.base.ts @@ -11,13 +11,13 @@ https://docs.amplication.com/how-to/custom-code */ import * as common from "@nestjs/common"; import * as swagger from "@nestjs/swagger"; -import * as nestAccessControl from "nest-access-control"; -import * as defaultAuthGuard from "../../auth/defaultAuth.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import * as errors from "../../errors"; import { Request } from "express"; import { plainToClass } from "class-transformer"; import { ApiNestedQuery } from "../../decorators/api-nested-query.decorator"; +import * as nestAccessControl from "nest-access-control"; +import * as defaultAuthGuard from "../../auth/defaultAuth.guard"; import { UserService } from "../user.service"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; @@ -27,6 +27,7 @@ import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; import { UserFindManyArgs } from "./UserFindManyArgs"; import { UserUpdateInput } from "./UserUpdateInput"; import { User } from "./User"; + @swagger.ApiBearerAuth() @common.UseGuards(defaultAuthGuard.DefaultAuthGuard, nestAccessControl.ACGuard) export class UserControllerBase { @@ -34,16 +35,17 @@ export class UserControllerBase { protected readonly service: UserService, protected readonly rolesBuilder: nestAccessControl.RolesBuilder ) {} - @common.UseInterceptors(AclValidateRequestInterceptor) + @common.Post() + @swagger.ApiCreatedResponse({ type: User }) @nestAccessControl.UseRoles({ resource: "User", action: "create", possession: "any", }) - @common.Post() - @swagger.ApiCreatedResponse({ type: User }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async create(@common.Body() data: UserCreateInput): Promise { return await this.service.create({ data: data, @@ -60,15 +62,17 @@ export class UserControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get() + @swagger.ApiOkResponse({ type: [User] }) + @ApiNestedQuery(UserFindManyArgs) @nestAccessControl.UseRoles({ resource: "User", action: "read", possession: "any", }) - @common.Get() - @swagger.ApiOkResponse({ type: [User] }) - @swagger.ApiForbiddenResponse() - @ApiNestedQuery(UserFindManyArgs) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async findMany(@common.Req() request: Request): Promise { const args = plainToClass(UserFindManyArgs, request.query); return this.service.findMany({ @@ -86,15 +90,17 @@ export class UserControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get("/:id") + @swagger.ApiOkResponse({ type: User }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "User", action: "read", possession: "own", }) - @common.Get("/:id") - @swagger.ApiOkResponse({ type: User }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async findOne( @common.Param() params: UserWhereUniqueInput ): Promise { @@ -119,15 +125,17 @@ export class UserControllerBase { } @common.UseInterceptors(AclValidateRequestInterceptor) + @common.Patch("/:id") + @swagger.ApiOkResponse({ type: User }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "User", action: "update", possession: "any", }) - @common.Patch("/:id") - @swagger.ApiOkResponse({ type: User }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async update( @common.Param() params: UserWhereUniqueInput, @common.Body() data: UserUpdateInput @@ -156,15 +164,17 @@ export class UserControllerBase { } } + @common.Delete("/:id") + @swagger.ApiOkResponse({ type: User }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "User", action: "delete", possession: "any", }) - @common.Delete("/:id") - @swagger.ApiOkResponse({ type: User }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async delete( @common.Param() params: UserWhereUniqueInput ): Promise { diff --git a/apps/logistic-server/src/user/base/user.module.base.ts b/apps/logistic-server/src/user/base/user.module.base.ts index ed8ce8d..76d29fe 100644 --- a/apps/logistic-server/src/user/base/user.module.base.ts +++ b/apps/logistic-server/src/user/base/user.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class UserModuleBase {} diff --git a/apps/logistic-server/src/warehouse/base/CreateWarehouseArgs.ts b/apps/logistic-server/src/warehouse/base/CreateWarehouseArgs.ts index 2e471fd..5cb8352 100644 --- a/apps/logistic-server/src/warehouse/base/CreateWarehouseArgs.ts +++ b/apps/logistic-server/src/warehouse/base/CreateWarehouseArgs.ts @@ -18,4 +18,4 @@ class CreateWarehouseArgs { data!: WarehouseCreateInput; } -export { CreateWarehouseArgs }; +export { CreateWarehouseArgs as CreateWarehouseArgs }; diff --git a/apps/logistic-server/src/warehouse/base/DeleteWarehouseArgs.ts b/apps/logistic-server/src/warehouse/base/DeleteWarehouseArgs.ts index b12c972..d73962b 100644 --- a/apps/logistic-server/src/warehouse/base/DeleteWarehouseArgs.ts +++ b/apps/logistic-server/src/warehouse/base/DeleteWarehouseArgs.ts @@ -18,4 +18,4 @@ class DeleteWarehouseArgs { where!: WarehouseWhereUniqueInput; } -export { DeleteWarehouseArgs }; +export { DeleteWarehouseArgs as DeleteWarehouseArgs }; diff --git a/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts b/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts index 8645d95..03d5a0c 100644 --- a/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts +++ b/apps/logistic-server/src/warehouse/base/ShipmentCreateNestedManyWithoutWarehousesInput.ts @@ -25,4 +25,4 @@ class ShipmentCreateNestedManyWithoutWarehousesInput { connect?: Array; } -export { ShipmentCreateNestedManyWithoutWarehousesInput }; +export { ShipmentCreateNestedManyWithoutWarehousesInput as ShipmentCreateNestedManyWithoutWarehousesInput }; diff --git a/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts b/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts index 2a11e9c..406650c 100644 --- a/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts +++ b/apps/logistic-server/src/warehouse/base/ShipmentUpdateManyWithoutWarehousesInput.ts @@ -43,4 +43,4 @@ class ShipmentUpdateManyWithoutWarehousesInput { set?: Array; } -export { ShipmentUpdateManyWithoutWarehousesInput }; +export { ShipmentUpdateManyWithoutWarehousesInput as ShipmentUpdateManyWithoutWarehousesInput }; diff --git a/apps/logistic-server/src/warehouse/base/UpdateWarehouseArgs.ts b/apps/logistic-server/src/warehouse/base/UpdateWarehouseArgs.ts index 74920d2..6b7b863 100644 --- a/apps/logistic-server/src/warehouse/base/UpdateWarehouseArgs.ts +++ b/apps/logistic-server/src/warehouse/base/UpdateWarehouseArgs.ts @@ -21,4 +21,4 @@ class UpdateWarehouseArgs { data!: WarehouseUpdateInput; } -export { UpdateWarehouseArgs }; +export { UpdateWarehouseArgs as UpdateWarehouseArgs }; diff --git a/apps/logistic-server/src/warehouse/base/Warehouse.ts b/apps/logistic-server/src/warehouse/base/Warehouse.ts index d00df8b..8d45656 100644 --- a/apps/logistic-server/src/warehouse/base/Warehouse.ts +++ b/apps/logistic-server/src/warehouse/base/Warehouse.ts @@ -73,4 +73,4 @@ class Warehouse { updatedAt!: Date; } -export { Warehouse }; +export { Warehouse as Warehouse }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts index a3cc63d..2191c38 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseCreateInput.ts @@ -52,4 +52,4 @@ class WarehouseCreateInput { shipments?: ShipmentCreateNestedManyWithoutWarehousesInput; } -export { WarehouseCreateInput }; +export { WarehouseCreateInput as WarehouseCreateInput }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseFindManyArgs.ts b/apps/logistic-server/src/warehouse/base/WarehouseFindManyArgs.ts index 3dbecd8..2b4216a 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseFindManyArgs.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseFindManyArgs.ts @@ -50,4 +50,4 @@ class WarehouseFindManyArgs { take?: number; } -export { WarehouseFindManyArgs }; +export { WarehouseFindManyArgs as WarehouseFindManyArgs }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseFindUniqueArgs.ts b/apps/logistic-server/src/warehouse/base/WarehouseFindUniqueArgs.ts index bdfda52..7e44bb0 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseFindUniqueArgs.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseFindUniqueArgs.ts @@ -18,4 +18,4 @@ class WarehouseFindUniqueArgs { where!: WarehouseWhereUniqueInput; } -export { WarehouseFindUniqueArgs }; +export { WarehouseFindUniqueArgs as WarehouseFindUniqueArgs }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseListRelationFilter.ts b/apps/logistic-server/src/warehouse/base/WarehouseListRelationFilter.ts index 873b4a0..529e7ec 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseListRelationFilter.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseListRelationFilter.ts @@ -53,4 +53,4 @@ class WarehouseListRelationFilter { }) none?: WarehouseWhereInput; } -export { WarehouseListRelationFilter }; +export { WarehouseListRelationFilter as WarehouseListRelationFilter }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseOrderByInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseOrderByInput.ts index 224eadf..39ed582 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseOrderByInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseOrderByInput.ts @@ -64,4 +64,4 @@ class WarehouseOrderByInput { updatedAt?: SortOrder; } -export { WarehouseOrderByInput }; +export { WarehouseOrderByInput as WarehouseOrderByInput }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts index 9fa292f..40f5fa8 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseUpdateInput.ts @@ -52,4 +52,4 @@ class WarehouseUpdateInput { shipments?: ShipmentUpdateManyWithoutWarehousesInput; } -export { WarehouseUpdateInput }; +export { WarehouseUpdateInput as WarehouseUpdateInput }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts index 8661774..184697d 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseWhereInput.ts @@ -65,4 +65,4 @@ class WarehouseWhereInput { shipments?: ShipmentListRelationFilter; } -export { WarehouseWhereInput }; +export { WarehouseWhereInput as WarehouseWhereInput }; diff --git a/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts b/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts index bf457b4..30fbca4 100644 --- a/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts +++ b/apps/logistic-server/src/warehouse/base/WarehouseWhereUniqueInput.ts @@ -24,4 +24,4 @@ class WarehouseWhereUniqueInput { id!: string; } -export { WarehouseWhereUniqueInput }; +export { WarehouseWhereUniqueInput as WarehouseWhereUniqueInput }; diff --git a/apps/logistic-server/src/warehouse/base/warehouse.controller.base.ts b/apps/logistic-server/src/warehouse/base/warehouse.controller.base.ts index bab89a5..a0d4d4e 100644 --- a/apps/logistic-server/src/warehouse/base/warehouse.controller.base.ts +++ b/apps/logistic-server/src/warehouse/base/warehouse.controller.base.ts @@ -11,13 +11,13 @@ https://docs.amplication.com/how-to/custom-code */ import * as common from "@nestjs/common"; import * as swagger from "@nestjs/swagger"; -import * as nestAccessControl from "nest-access-control"; -import * as defaultAuthGuard from "../../auth/defaultAuth.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import * as errors from "../../errors"; import { Request } from "express"; import { plainToClass } from "class-transformer"; import { ApiNestedQuery } from "../../decorators/api-nested-query.decorator"; +import * as nestAccessControl from "nest-access-control"; +import * as defaultAuthGuard from "../../auth/defaultAuth.guard"; import { WarehouseService } from "../warehouse.service"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; @@ -30,6 +30,7 @@ import { Warehouse } from "./Warehouse"; import { ShipmentFindManyArgs } from "../../shipment/base/ShipmentFindManyArgs"; import { Shipment } from "../../shipment/base/Shipment"; import { ShipmentWhereUniqueInput } from "../../shipment/base/ShipmentWhereUniqueInput"; + @swagger.ApiBearerAuth() @common.UseGuards(defaultAuthGuard.DefaultAuthGuard, nestAccessControl.ACGuard) export class WarehouseControllerBase { @@ -37,16 +38,17 @@ export class WarehouseControllerBase { protected readonly service: WarehouseService, protected readonly rolesBuilder: nestAccessControl.RolesBuilder ) {} - @common.UseInterceptors(AclValidateRequestInterceptor) + @common.Post() + @swagger.ApiCreatedResponse({ type: Warehouse }) @nestAccessControl.UseRoles({ resource: "Warehouse", action: "create", possession: "any", }) - @common.Post() - @swagger.ApiCreatedResponse({ type: Warehouse }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async create(@common.Body() data: WarehouseCreateInput): Promise { return await this.service.create({ data: data, @@ -61,15 +63,17 @@ export class WarehouseControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get() + @swagger.ApiOkResponse({ type: [Warehouse] }) + @ApiNestedQuery(WarehouseFindManyArgs) @nestAccessControl.UseRoles({ resource: "Warehouse", action: "read", possession: "any", }) - @common.Get() - @swagger.ApiOkResponse({ type: [Warehouse] }) - @swagger.ApiForbiddenResponse() - @ApiNestedQuery(WarehouseFindManyArgs) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async findMany(@common.Req() request: Request): Promise { const args = plainToClass(WarehouseFindManyArgs, request.query); return this.service.findMany({ @@ -85,15 +89,17 @@ export class WarehouseControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get("/:id") + @swagger.ApiOkResponse({ type: Warehouse }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "Warehouse", action: "read", possession: "own", }) - @common.Get("/:id") - @swagger.ApiOkResponse({ type: Warehouse }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async findOne( @common.Param() params: WarehouseWhereUniqueInput ): Promise { @@ -116,15 +122,17 @@ export class WarehouseControllerBase { } @common.UseInterceptors(AclValidateRequestInterceptor) + @common.Patch("/:id") + @swagger.ApiOkResponse({ type: Warehouse }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "Warehouse", action: "update", possession: "any", }) - @common.Patch("/:id") - @swagger.ApiOkResponse({ type: Warehouse }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async update( @common.Param() params: WarehouseWhereUniqueInput, @common.Body() data: WarehouseUpdateInput @@ -151,15 +159,17 @@ export class WarehouseControllerBase { } } + @common.Delete("/:id") + @swagger.ApiOkResponse({ type: Warehouse }) + @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) @nestAccessControl.UseRoles({ resource: "Warehouse", action: "delete", possession: "any", }) - @common.Delete("/:id") - @swagger.ApiOkResponse({ type: Warehouse }) - @swagger.ApiNotFoundResponse({ type: errors.NotFoundException }) - @swagger.ApiForbiddenResponse({ type: errors.ForbiddenException }) + @swagger.ApiForbiddenResponse({ + type: errors.ForbiddenException, + }) async delete( @common.Param() params: WarehouseWhereUniqueInput ): Promise { @@ -185,13 +195,13 @@ export class WarehouseControllerBase { } @common.UseInterceptors(AclFilterResponseInterceptor) + @common.Get("/:id/shipments") + @ApiNestedQuery(ShipmentFindManyArgs) @nestAccessControl.UseRoles({ resource: "Shipment", action: "read", possession: "any", }) - @common.Get("/:id/shipments") - @ApiNestedQuery(ShipmentFindManyArgs) async findManyShipments( @common.Req() request: Request, @common.Param() params: WarehouseWhereUniqueInput @@ -214,12 +224,12 @@ export class WarehouseControllerBase { return results; } + @common.Post("/:id/shipments") @nestAccessControl.UseRoles({ resource: "Warehouse", action: "update", possession: "any", }) - @common.Post("/:id/shipments") async connectShipments( @common.Param() params: WarehouseWhereUniqueInput, @common.Body() body: ShipmentWhereUniqueInput[] @@ -236,12 +246,12 @@ export class WarehouseControllerBase { }); } + @common.Patch("/:id/shipments") @nestAccessControl.UseRoles({ resource: "Warehouse", action: "update", possession: "any", }) - @common.Patch("/:id/shipments") async updateShipments( @common.Param() params: WarehouseWhereUniqueInput, @common.Body() body: ShipmentWhereUniqueInput[] @@ -258,12 +268,12 @@ export class WarehouseControllerBase { }); } + @common.Delete("/:id/shipments") @nestAccessControl.UseRoles({ resource: "Warehouse", action: "update", possession: "any", }) - @common.Delete("/:id/shipments") async disconnectShipments( @common.Param() params: WarehouseWhereUniqueInput, @common.Body() body: ShipmentWhereUniqueInput[] diff --git a/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts b/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts index 24efee7..010158c 100644 --- a/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts +++ b/apps/logistic-server/src/warehouse/base/warehouse.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class WarehouseModuleBase {} From 836410daada15797334f2f83b8d57b3ae109b641 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Tue, 21 Feb 2023 18:12:13 +0000 Subject: [PATCH 79/85] Amplication build # cleekcisy01wmiu01y7d29rw7. Commit message: https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbox9qt800t6nm017tzaup5o/builds/cleekcisy01wmiu01y7d29rw7 --- apps/ecommerce-server/.env | 6 +-- apps/ecommerce-server/package.json | 7 ++-- apps/ecommerce-server/scripts/customSeed.ts | 10 ----- apps/ecommerce-server/scripts/seed.ts | 11 ++++-- .../src/address/address.resolver.ts | 6 +-- .../src/address/base/Address.ts | 2 +- .../src/address/base/AddressCreateInput.ts | 2 +- .../src/address/base/AddressFindManyArgs.ts | 2 +- .../src/address/base/AddressFindUniqueArgs.ts | 2 +- .../address/base/AddressListRelationFilter.ts | 2 +- .../src/address/base/AddressOrderByInput.ts | 2 +- .../src/address/base/AddressUpdateInput.ts | 2 +- .../src/address/base/AddressWhereInput.ts | 2 +- .../address/base/AddressWhereUniqueInput.ts | 2 +- .../src/address/base/CreateAddressArgs.ts | 2 +- ...erCreateNestedManyWithoutAddressesInput.ts | 2 +- ...CustomerUpdateManyWithoutAddressesInput.ts | 2 +- .../src/address/base/DeleteAddressArgs.ts | 2 +- .../src/address/base/UpdateAddressArgs.ts | 2 +- .../src/address/base/address.module.base.ts | 2 - .../src/address/base/address.resolver.base.ts | 11 +++--- apps/ecommerce-server/src/app.module.ts | 10 ++--- apps/ecommerce-server/src/auth/auth.module.ts | 3 -- .../ecommerce-server/src/auth/auth.service.ts | 1 - .../auth/basic/base/basic.strategy.base.ts | 23 ------------ .../src/auth/basic/basic.strategy.ts | 10 ----- .../src/auth/basic/basicAuth.guard.ts | 3 -- .../src/auth/jwt/base/jwt.strategy.base.ts | 3 +- .../src/auth/password.service.spec.ts | 2 - .../src/auth/token.service.ts | 5 ++- .../src/auth/userData.decorator.ts | 1 - .../src/customer/base/CreateCustomerArgs.ts | 2 +- .../src/customer/base/Customer.ts | 2 +- .../src/customer/base/CustomerCreateInput.ts | 2 +- .../src/customer/base/CustomerFindManyArgs.ts | 2 +- .../customer/base/CustomerFindUniqueArgs.ts | 2 +- .../base/CustomerListRelationFilter.ts | 2 +- .../src/customer/base/CustomerOrderByInput.ts | 2 +- .../src/customer/base/CustomerUpdateInput.ts | 2 +- .../src/customer/base/CustomerWhereInput.ts | 2 +- .../customer/base/CustomerWhereUniqueInput.ts | 2 +- .../src/customer/base/DeleteCustomerArgs.ts | 2 +- ...erCreateNestedManyWithoutCustomersInput.ts | 2 +- .../OrderUpdateManyWithoutCustomersInput.ts | 2 +- .../src/customer/base/UpdateCustomerArgs.ts | 2 +- .../src/customer/base/customer.module.base.ts | 2 - .../customer/base/customer.resolver.base.ts | 11 +++--- .../src/customer/customer.resolver.ts | 6 +-- apps/ecommerce-server/src/grants.json | 2 +- .../src/order/base/CreateOrderArgs.ts | 2 +- .../src/order/base/DeleteOrderArgs.ts | 2 +- apps/ecommerce-server/src/order/base/Order.ts | 2 +- .../src/order/base/OrderCreateInput.ts | 2 +- .../src/order/base/OrderFindManyArgs.ts | 2 +- .../src/order/base/OrderFindUniqueArgs.ts | 2 +- .../src/order/base/OrderListRelationFilter.ts | 2 +- .../src/order/base/OrderOrderByInput.ts | 2 +- .../src/order/base/OrderUpdateInput.ts | 2 +- .../src/order/base/OrderWhereInput.ts | 2 +- .../src/order/base/OrderWhereUniqueInput.ts | 2 +- .../src/order/base/UpdateOrderArgs.ts | 2 +- .../src/order/base/order.module.base.ts | 2 - .../src/order/base/order.resolver.base.ts | 11 +++--- .../src/order/order.resolver.ts | 6 +-- .../src/product/base/CreateProductArgs.ts | 2 +- .../src/product/base/DeleteProductArgs.ts | 2 +- ...derCreateNestedManyWithoutProductsInput.ts | 2 +- .../OrderUpdateManyWithoutProductsInput.ts | 2 +- .../src/product/base/Product.ts | 2 +- .../src/product/base/ProductCreateInput.ts | 2 +- .../src/product/base/ProductFindManyArgs.ts | 2 +- .../src/product/base/ProductFindUniqueArgs.ts | 2 +- .../product/base/ProductListRelationFilter.ts | 2 +- .../src/product/base/ProductOrderByInput.ts | 2 +- .../src/product/base/ProductUpdateInput.ts | 2 +- .../src/product/base/ProductWhereInput.ts | 2 +- .../product/base/ProductWhereUniqueInput.ts | 2 +- .../src/product/base/UpdateProductArgs.ts | 2 +- .../src/product/base/product.module.base.ts | 2 - .../src/product/base/product.resolver.base.ts | 11 +++--- .../src/product/product.resolver.ts | 6 +-- apps/ecommerce-server/src/swagger.ts | 2 +- .../tests/auth/basic/basic.strategy.spec.ts | 37 ------------------- .../src/user/base/CreateUserArgs.ts | 2 +- .../src/user/base/DeleteUserArgs.ts | 2 +- .../src/user/base/UpdateUserArgs.ts | 2 +- apps/ecommerce-server/src/user/base/User.ts | 2 +- .../src/user/base/UserCreateInput.ts | 2 +- .../src/user/base/UserFindManyArgs.ts | 2 +- .../src/user/base/UserFindUniqueArgs.ts | 2 +- .../src/user/base/UserListRelationFilter.ts | 2 +- .../src/user/base/UserOrderByInput.ts | 2 +- .../src/user/base/UserUpdateInput.ts | 2 +- .../src/user/base/UserWhereInput.ts | 2 +- .../src/user/base/UserWhereUniqueInput.ts | 2 +- .../src/user/base/user.module.base.ts | 2 - .../src/user/base/user.resolver.base.ts | 11 +++--- .../src/user/user.resolver.ts | 6 +-- .../ecommerce-server/src/user/user.service.ts | 2 +- 99 files changed, 133 insertions(+), 232 deletions(-) delete mode 100644 apps/ecommerce-server/src/auth/basic/base/basic.strategy.base.ts delete mode 100644 apps/ecommerce-server/src/auth/basic/basic.strategy.ts delete mode 100644 apps/ecommerce-server/src/auth/basic/basicAuth.guard.ts delete mode 100644 apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts diff --git a/apps/ecommerce-server/.env b/apps/ecommerce-server/.env index f392474..1edc26c 100644 --- a/apps/ecommerce-server/.env +++ b/apps/ecommerce-server/.env @@ -1,7 +1,5 @@ BCRYPT_SALT=10 COMPOSE_PROJECT_NAME=amp_clbox9qt800t6nm017tzaup5o -JWT_SECRET_KEY=Change_ME!!! -JWT_EXPIRATION=2d PORT=3000 DB_USER=admin DB_PASSWORD=admin @@ -10,4 +8,6 @@ DB_URL=postgres://admin:admin@localhost:5432 KAFKA_BROKERS=localhost:9092 KAFKA_ENABLE_SSL=false KAFKA_CLIENT_ID=ecommerce -KAFKA_GROUP_ID=ecommerce \ No newline at end of file +KAFKA_GROUP_ID=ecommerce +JWT_SECRET_KEY=Change_ME!!! +JWT_EXPIRATION=2d \ No newline at end of file diff --git a/apps/ecommerce-server/package.json b/apps/ecommerce-server/package.json index 36f2c5a..c479b39 100644 --- a/apps/ecommerce-server/package.json +++ b/apps/ecommerce-server/package.json @@ -1,5 +1,6 @@ { - "name": "@ecommerce/server", + "name": "@sample-application/server", + "version": "0.1.3", "private": true, "scripts": { "start": "nest start", @@ -44,9 +45,7 @@ "passport-jwt": "4.0.0", "reflect-metadata": "0.1.13", "swagger-ui-express": "4.3.0", - "ts-node": "9.1.1", - "@nestjs/microservices": "8.2.3", - "kafkajs": "2.2.0" + "ts-node": "9.1.1" }, "devDependencies": { "@nestjs/cli": "8.2.5", diff --git a/apps/ecommerce-server/scripts/customSeed.ts b/apps/ecommerce-server/scripts/customSeed.ts index 6baf5f6..26ccaf4 100644 --- a/apps/ecommerce-server/scripts/customSeed.ts +++ b/apps/ecommerce-server/scripts/customSeed.ts @@ -2,16 +2,6 @@ import { PrismaClient } from "@prisma/client"; export async function customSeed() { const client = new PrismaClient(); - const username = "admin"; - - //replace this sample code to populate your database - //with data that is required for your service to start - await client.user.update({ - where: { username: username }, - data: { - username, - }, - }); client.$disconnect(); } diff --git a/apps/ecommerce-server/scripts/seed.ts b/apps/ecommerce-server/scripts/seed.ts index 3bb4d3a..272dddd 100644 --- a/apps/ecommerce-server/scripts/seed.ts +++ b/apps/ecommerce-server/scripts/seed.ts @@ -1,8 +1,8 @@ import * as dotenv from "dotenv"; import { PrismaClient } from "@prisma/client"; +import { customSeed } from "./customSeed"; import { Salt, parseSalt } from "../src/auth/password.service"; import { hash } from "bcrypt"; -import { customSeed } from "./customSeed"; if (require.main === module) { dotenv.config(); @@ -12,7 +12,6 @@ if (require.main === module) { if (!BCRYPT_SALT) { throw new Error("BCRYPT_SALT environment variable must be defined"); } - const salt = parseSalt(BCRYPT_SALT); seed(salt).catch((error) => { @@ -25,16 +24,22 @@ async function seed(bcryptSalt: Salt) { console.info("Seeding database..."); const client = new PrismaClient(); + const data = { username: "admin", password: await hash("admin", bcryptSalt), roles: ["user"], }; + await client.user.upsert({ - where: { username: data.username }, + where: { + username: data.username, + }, + update: {}, create: data, }); + void client.$disconnect(); console.info("Seeding database with custom seed..."); diff --git a/apps/ecommerce-server/src/address/address.resolver.ts b/apps/ecommerce-server/src/address/address.resolver.ts index b42eb41..f488247 100644 --- a/apps/ecommerce-server/src/address/address.resolver.ts +++ b/apps/ecommerce-server/src/address/address.resolver.ts @@ -1,14 +1,14 @@ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; import * as gqlACGuard from "../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { AddressResolverBase } from "./base/address.resolver.base"; import { Address } from "./base/Address"; import { AddressService } from "./address.service"; -@graphql.Resolver(() => Address) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Address) export class AddressResolver extends AddressResolverBase { constructor( protected readonly service: AddressService, diff --git a/apps/ecommerce-server/src/address/base/Address.ts b/apps/ecommerce-server/src/address/base/Address.ts index 6fe123a..fe668ab 100644 --- a/apps/ecommerce-server/src/address/base/Address.ts +++ b/apps/ecommerce-server/src/address/base/Address.ts @@ -112,4 +112,4 @@ class Address { zip!: number | null; } -export { Address }; +export { Address as Address }; diff --git a/apps/ecommerce-server/src/address/base/AddressCreateInput.ts b/apps/ecommerce-server/src/address/base/AddressCreateInput.ts index 68f4f95..05688a3 100644 --- a/apps/ecommerce-server/src/address/base/AddressCreateInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressCreateInput.ts @@ -85,4 +85,4 @@ class AddressCreateInput { zip?: number | null; } -export { AddressCreateInput }; +export { AddressCreateInput as AddressCreateInput }; diff --git a/apps/ecommerce-server/src/address/base/AddressFindManyArgs.ts b/apps/ecommerce-server/src/address/base/AddressFindManyArgs.ts index 37b2dd5..ca10168 100644 --- a/apps/ecommerce-server/src/address/base/AddressFindManyArgs.ts +++ b/apps/ecommerce-server/src/address/base/AddressFindManyArgs.ts @@ -50,4 +50,4 @@ class AddressFindManyArgs { take?: number; } -export { AddressFindManyArgs }; +export { AddressFindManyArgs as AddressFindManyArgs }; diff --git a/apps/ecommerce-server/src/address/base/AddressFindUniqueArgs.ts b/apps/ecommerce-server/src/address/base/AddressFindUniqueArgs.ts index ec249cb..cfdb33c 100644 --- a/apps/ecommerce-server/src/address/base/AddressFindUniqueArgs.ts +++ b/apps/ecommerce-server/src/address/base/AddressFindUniqueArgs.ts @@ -18,4 +18,4 @@ class AddressFindUniqueArgs { where!: AddressWhereUniqueInput; } -export { AddressFindUniqueArgs }; +export { AddressFindUniqueArgs as AddressFindUniqueArgs }; diff --git a/apps/ecommerce-server/src/address/base/AddressListRelationFilter.ts b/apps/ecommerce-server/src/address/base/AddressListRelationFilter.ts index b13d6ed..e0b3d07 100644 --- a/apps/ecommerce-server/src/address/base/AddressListRelationFilter.ts +++ b/apps/ecommerce-server/src/address/base/AddressListRelationFilter.ts @@ -53,4 +53,4 @@ class AddressListRelationFilter { }) none?: AddressWhereInput; } -export { AddressListRelationFilter }; +export { AddressListRelationFilter as AddressListRelationFilter }; diff --git a/apps/ecommerce-server/src/address/base/AddressOrderByInput.ts b/apps/ecommerce-server/src/address/base/AddressOrderByInput.ts index 676c75a..576da3e 100644 --- a/apps/ecommerce-server/src/address/base/AddressOrderByInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressOrderByInput.ts @@ -91,4 +91,4 @@ class AddressOrderByInput { zip?: SortOrder; } -export { AddressOrderByInput }; +export { AddressOrderByInput as AddressOrderByInput }; diff --git a/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts b/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts index d261ec0..d4d3c6d 100644 --- a/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressUpdateInput.ts @@ -85,4 +85,4 @@ class AddressUpdateInput { zip?: number | null; } -export { AddressUpdateInput }; +export { AddressUpdateInput as AddressUpdateInput }; diff --git a/apps/ecommerce-server/src/address/base/AddressWhereInput.ts b/apps/ecommerce-server/src/address/base/AddressWhereInput.ts index b0e7cd6..a98b865 100644 --- a/apps/ecommerce-server/src/address/base/AddressWhereInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressWhereInput.ts @@ -99,4 +99,4 @@ class AddressWhereInput { zip?: IntNullableFilter; } -export { AddressWhereInput }; +export { AddressWhereInput as AddressWhereInput }; diff --git a/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts b/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts index e117397..7493f2c 100644 --- a/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/address/base/AddressWhereUniqueInput.ts @@ -24,4 +24,4 @@ class AddressWhereUniqueInput { id!: string; } -export { AddressWhereUniqueInput }; +export { AddressWhereUniqueInput as AddressWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/address/base/CreateAddressArgs.ts b/apps/ecommerce-server/src/address/base/CreateAddressArgs.ts index 0836aee..9c4cd60 100644 --- a/apps/ecommerce-server/src/address/base/CreateAddressArgs.ts +++ b/apps/ecommerce-server/src/address/base/CreateAddressArgs.ts @@ -18,4 +18,4 @@ class CreateAddressArgs { data!: AddressCreateInput; } -export { CreateAddressArgs }; +export { CreateAddressArgs as CreateAddressArgs }; diff --git a/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts b/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts index bad138f..0a39eef 100644 --- a/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts +++ b/apps/ecommerce-server/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts @@ -25,4 +25,4 @@ class CustomerCreateNestedManyWithoutAddressesInput { connect?: Array; } -export { CustomerCreateNestedManyWithoutAddressesInput }; +export { CustomerCreateNestedManyWithoutAddressesInput as CustomerCreateNestedManyWithoutAddressesInput }; diff --git a/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts b/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts index 98bbc5a..1b153b7 100644 --- a/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts +++ b/apps/ecommerce-server/src/address/base/CustomerUpdateManyWithoutAddressesInput.ts @@ -43,4 +43,4 @@ class CustomerUpdateManyWithoutAddressesInput { set?: Array; } -export { CustomerUpdateManyWithoutAddressesInput }; +export { CustomerUpdateManyWithoutAddressesInput as CustomerUpdateManyWithoutAddressesInput }; diff --git a/apps/ecommerce-server/src/address/base/DeleteAddressArgs.ts b/apps/ecommerce-server/src/address/base/DeleteAddressArgs.ts index cc4ee28..5828be9 100644 --- a/apps/ecommerce-server/src/address/base/DeleteAddressArgs.ts +++ b/apps/ecommerce-server/src/address/base/DeleteAddressArgs.ts @@ -18,4 +18,4 @@ class DeleteAddressArgs { where!: AddressWhereUniqueInput; } -export { DeleteAddressArgs }; +export { DeleteAddressArgs as DeleteAddressArgs }; diff --git a/apps/ecommerce-server/src/address/base/UpdateAddressArgs.ts b/apps/ecommerce-server/src/address/base/UpdateAddressArgs.ts index 3237a3e..31ae66b 100644 --- a/apps/ecommerce-server/src/address/base/UpdateAddressArgs.ts +++ b/apps/ecommerce-server/src/address/base/UpdateAddressArgs.ts @@ -21,4 +21,4 @@ class UpdateAddressArgs { data!: AddressUpdateInput; } -export { UpdateAddressArgs }; +export { UpdateAddressArgs as UpdateAddressArgs }; diff --git a/apps/ecommerce-server/src/address/base/address.module.base.ts b/apps/ecommerce-server/src/address/base/address.module.base.ts index 9204e4d..78f78ea 100644 --- a/apps/ecommerce-server/src/address/base/address.module.base.ts +++ b/apps/ecommerce-server/src/address/base/address.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class AddressModuleBase {} diff --git a/apps/ecommerce-server/src/address/base/address.resolver.base.ts b/apps/ecommerce-server/src/address/base/address.resolver.base.ts index bef65a4..cb9edee 100644 --- a/apps/ecommerce-server/src/address/base/address.resolver.base.ts +++ b/apps/ecommerce-server/src/address/base/address.resolver.base.ts @@ -9,14 +9,14 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as apollo from "apollo-server-express"; -import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; -import * as gqlACGuard from "../../auth/gqlAC.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import { MetaQueryPayload } from "../../util/MetaQueryPayload"; +import * as nestAccessControl from "nest-access-control"; +import * as gqlACGuard from "../../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { CreateAddressArgs } from "./CreateAddressArgs"; @@ -28,9 +28,8 @@ import { Address } from "./Address"; import { CustomerFindManyArgs } from "../../customer/base/CustomerFindManyArgs"; import { Customer } from "../../customer/base/Customer"; import { AddressService } from "../address.service"; - -@graphql.Resolver(() => Address) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Address) export class AddressResolverBase { constructor( protected readonly service: AddressService, diff --git a/apps/ecommerce-server/src/app.module.ts b/apps/ecommerce-server/src/app.module.ts index d66c15b..55d32af 100644 --- a/apps/ecommerce-server/src/app.module.ts +++ b/apps/ecommerce-server/src/app.module.ts @@ -6,8 +6,6 @@ import { OrderModule } from "./order/order.module"; import { CustomerModule } from "./customer/customer.module"; import { AddressModule } from "./address/address.module"; import { ProductModule } from "./product/product.module"; -import { ACLModule } from "./auth/acl.module"; -import { AuthModule } from "./auth/auth.module"; import { HealthModule } from "./health/health.module"; import { PrismaModule } from "./prisma/prisma.module"; import { SecretsManagerModule } from "./providers/secrets/secretsManager.module"; @@ -17,20 +15,22 @@ import { ServeStaticModule } from "@nestjs/serve-static"; import { ServeStaticOptionsService } from "./serveStaticOptions.service"; import { GraphQLModule } from "@nestjs/graphql"; +import { ACLModule } from "./auth/acl.module"; +import { AuthModule } from "./auth/auth.module"; + @Module({ controllers: [], imports: [ + ACLModule, + AuthModule, UserModule, OrderModule, CustomerModule, AddressModule, ProductModule, - ACLModule, - AuthModule, HealthModule, PrismaModule, SecretsManagerModule, - KafkaModule, MorganModule, ConfigModule.forRoot({ isGlobal: true }), ServeStaticModule.forRootAsync({ diff --git a/apps/ecommerce-server/src/auth/auth.module.ts b/apps/ecommerce-server/src/auth/auth.module.ts index f827706..b394a74 100644 --- a/apps/ecommerce-server/src/auth/auth.module.ts +++ b/apps/ecommerce-server/src/auth/auth.module.ts @@ -11,11 +11,9 @@ import { UserModule } from "../user/user.module"; import { AuthController } from "./auth.controller"; import { AuthResolver } from "./auth.resolver"; import { AuthService } from "./auth.service"; -import { BasicStrategy } from "./basic/basic.strategy"; import { JwtStrategy } from "./jwt/jwt.strategy"; import { jwtSecretFactory } from "./jwt/jwtSecretFactory"; import { PasswordService } from "./password.service"; -//@ts-ignore import { TokenService } from "./token.service"; @Module({ @@ -47,7 +45,6 @@ import { TokenService } from "./token.service"; ], providers: [ AuthService, - BasicStrategy, PasswordService, AuthResolver, JwtStrategy, diff --git a/apps/ecommerce-server/src/auth/auth.service.ts b/apps/ecommerce-server/src/auth/auth.service.ts index 1d7d531..b54440b 100644 --- a/apps/ecommerce-server/src/auth/auth.service.ts +++ b/apps/ecommerce-server/src/auth/auth.service.ts @@ -38,7 +38,6 @@ export class AuthService { if (!user) { throw new UnauthorizedException("The passed credentials are incorrect"); } - //@ts-ignore const accessToken = await this.tokenService.createToken({ id: user.id, username, diff --git a/apps/ecommerce-server/src/auth/basic/base/basic.strategy.base.ts b/apps/ecommerce-server/src/auth/basic/base/basic.strategy.base.ts deleted file mode 100644 index e138356..0000000 --- a/apps/ecommerce-server/src/auth/basic/base/basic.strategy.base.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { UnauthorizedException } from "@nestjs/common"; -import { PassportStrategy } from "@nestjs/passport"; -import { BasicStrategy as Strategy } from "passport-http"; -import { AuthService } from "../../auth.service"; -import { IAuthStrategy } from "../../IAuthStrategy"; -import { UserInfo } from "../../UserInfo"; - -export class BasicStrategyBase - extends PassportStrategy(Strategy) - implements IAuthStrategy -{ - constructor(protected readonly authService: AuthService) { - super(); - } - - async validate(username: string, password: string): Promise { - const user = await this.authService.validateUser(username, password); - if (!user) { - throw new UnauthorizedException(); - } - return user; - } -} diff --git a/apps/ecommerce-server/src/auth/basic/basic.strategy.ts b/apps/ecommerce-server/src/auth/basic/basic.strategy.ts deleted file mode 100644 index f087795..0000000 --- a/apps/ecommerce-server/src/auth/basic/basic.strategy.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Injectable } from "@nestjs/common"; -import { AuthService } from "../auth.service"; -import { BasicStrategyBase } from "./base/basic.strategy.base"; - -@Injectable() -export class BasicStrategy extends BasicStrategyBase { - constructor(protected readonly authService: AuthService) { - super(authService); - } -} diff --git a/apps/ecommerce-server/src/auth/basic/basicAuth.guard.ts b/apps/ecommerce-server/src/auth/basic/basicAuth.guard.ts deleted file mode 100644 index 9c92fdd..0000000 --- a/apps/ecommerce-server/src/auth/basic/basicAuth.guard.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { AuthGuard } from "@nestjs/passport"; - -export class BasicAuthGuard extends AuthGuard("basic") {} diff --git a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts index d7d7cb1..7766538 100644 --- a/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts +++ b/apps/ecommerce-server/src/auth/jwt/base/jwt.strategy.base.ts @@ -7,7 +7,8 @@ import { UserInfo } from "../../UserInfo"; export class JwtStrategyBase extends PassportStrategy(Strategy) - implements IAuthStrategy { + implements IAuthStrategy +{ constructor( protected readonly userService: UserService, protected readonly secretOrKey: string diff --git a/apps/ecommerce-server/src/auth/password.service.spec.ts b/apps/ecommerce-server/src/auth/password.service.spec.ts index 72f21a9..79c5a44 100644 --- a/apps/ecommerce-server/src/auth/password.service.spec.ts +++ b/apps/ecommerce-server/src/auth/password.service.spec.ts @@ -14,10 +14,8 @@ const configServiceGetMock = jest.fn(() => { jest.mock("bcrypt"); -//@ts-ignore bcrypt.hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); -//@ts-ignore bcrypt.compare.mockImplementation(async () => true); describe("PasswordService", () => { diff --git a/apps/ecommerce-server/src/auth/token.service.ts b/apps/ecommerce-server/src/auth/token.service.ts index f789d61..b102b72 100644 --- a/apps/ecommerce-server/src/auth/token.service.ts +++ b/apps/ecommerce-server/src/auth/token.service.ts @@ -1,6 +1,7 @@ -import { ITokenService } from "./ITokenService"; //@ts-ignore +import { ITokenService } from "./ITokenService"; // eslint-disable-next-line import/no-unresolved -import { TokenServiceBase } from "./base/token.service.base"; //@ts-ignore +import { TokenServiceBase } from "./base/token.service.base"; + export class TokenService extends TokenServiceBase implements ITokenService {} diff --git a/apps/ecommerce-server/src/auth/userData.decorator.ts b/apps/ecommerce-server/src/auth/userData.decorator.ts index 240c7d9..6a40ad1 100644 --- a/apps/ecommerce-server/src/auth/userData.decorator.ts +++ b/apps/ecommerce-server/src/auth/userData.decorator.ts @@ -1,6 +1,5 @@ import { createParamDecorator, ExecutionContext } from "@nestjs/common"; import { GqlContextType, GqlExecutionContext } from "@nestjs/graphql"; -//@ts-ignore import { User } from "@prisma/client"; /** diff --git a/apps/ecommerce-server/src/customer/base/CreateCustomerArgs.ts b/apps/ecommerce-server/src/customer/base/CreateCustomerArgs.ts index 863e04f..b119d43 100644 --- a/apps/ecommerce-server/src/customer/base/CreateCustomerArgs.ts +++ b/apps/ecommerce-server/src/customer/base/CreateCustomerArgs.ts @@ -18,4 +18,4 @@ class CreateCustomerArgs { data!: CustomerCreateInput; } -export { CreateCustomerArgs }; +export { CreateCustomerArgs as CreateCustomerArgs }; diff --git a/apps/ecommerce-server/src/customer/base/Customer.ts b/apps/ecommerce-server/src/customer/base/Customer.ts index 3265ecc..e082534 100644 --- a/apps/ecommerce-server/src/customer/base/Customer.ts +++ b/apps/ecommerce-server/src/customer/base/Customer.ts @@ -105,4 +105,4 @@ class Customer { updatedAt!: Date; } -export { Customer }; +export { Customer as Customer }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts b/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts index 743faa1..c5fdcd1 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerCreateInput.ts @@ -87,4 +87,4 @@ class CustomerCreateInput { phone?: string | null; } -export { CustomerCreateInput }; +export { CustomerCreateInput as CustomerCreateInput }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerFindManyArgs.ts b/apps/ecommerce-server/src/customer/base/CustomerFindManyArgs.ts index 3d6e1f9..67d0fa3 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerFindManyArgs.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerFindManyArgs.ts @@ -50,4 +50,4 @@ class CustomerFindManyArgs { take?: number; } -export { CustomerFindManyArgs }; +export { CustomerFindManyArgs as CustomerFindManyArgs }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerFindUniqueArgs.ts b/apps/ecommerce-server/src/customer/base/CustomerFindUniqueArgs.ts index fc0d41d..e3db82f 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerFindUniqueArgs.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerFindUniqueArgs.ts @@ -18,4 +18,4 @@ class CustomerFindUniqueArgs { where!: CustomerWhereUniqueInput; } -export { CustomerFindUniqueArgs }; +export { CustomerFindUniqueArgs as CustomerFindUniqueArgs }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerListRelationFilter.ts b/apps/ecommerce-server/src/customer/base/CustomerListRelationFilter.ts index f1445b8..5d73d88 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerListRelationFilter.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerListRelationFilter.ts @@ -53,4 +53,4 @@ class CustomerListRelationFilter { }) none?: CustomerWhereInput; } -export { CustomerListRelationFilter }; +export { CustomerListRelationFilter as CustomerListRelationFilter }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerOrderByInput.ts b/apps/ecommerce-server/src/customer/base/CustomerOrderByInput.ts index ad3e964..3e76e4e 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerOrderByInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerOrderByInput.ts @@ -91,4 +91,4 @@ class CustomerOrderByInput { updatedAt?: SortOrder; } -export { CustomerOrderByInput }; +export { CustomerOrderByInput as CustomerOrderByInput }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts b/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts index 0f339dc..f3bc170 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerUpdateInput.ts @@ -87,4 +87,4 @@ class CustomerUpdateInput { phone?: string | null; } -export { CustomerUpdateInput }; +export { CustomerUpdateInput as CustomerUpdateInput }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts b/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts index 6bbee20..f16156f 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerWhereInput.ts @@ -100,4 +100,4 @@ class CustomerWhereInput { phone?: StringNullableFilter; } -export { CustomerWhereInput }; +export { CustomerWhereInput as CustomerWhereInput }; diff --git a/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts b/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts index c7a5b76..02c3d87 100644 --- a/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/customer/base/CustomerWhereUniqueInput.ts @@ -24,4 +24,4 @@ class CustomerWhereUniqueInput { id!: string; } -export { CustomerWhereUniqueInput }; +export { CustomerWhereUniqueInput as CustomerWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/customer/base/DeleteCustomerArgs.ts b/apps/ecommerce-server/src/customer/base/DeleteCustomerArgs.ts index ab14d44..50e4b95 100644 --- a/apps/ecommerce-server/src/customer/base/DeleteCustomerArgs.ts +++ b/apps/ecommerce-server/src/customer/base/DeleteCustomerArgs.ts @@ -18,4 +18,4 @@ class DeleteCustomerArgs { where!: CustomerWhereUniqueInput; } -export { DeleteCustomerArgs }; +export { DeleteCustomerArgs as DeleteCustomerArgs }; diff --git a/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts b/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts index 3896d63..1e357d5 100644 --- a/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts +++ b/apps/ecommerce-server/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts @@ -25,4 +25,4 @@ class OrderCreateNestedManyWithoutCustomersInput { connect?: Array; } -export { OrderCreateNestedManyWithoutCustomersInput }; +export { OrderCreateNestedManyWithoutCustomersInput as OrderCreateNestedManyWithoutCustomersInput }; diff --git a/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts b/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts index 7669675..9d53a35 100644 --- a/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts +++ b/apps/ecommerce-server/src/customer/base/OrderUpdateManyWithoutCustomersInput.ts @@ -43,4 +43,4 @@ class OrderUpdateManyWithoutCustomersInput { set?: Array; } -export { OrderUpdateManyWithoutCustomersInput }; +export { OrderUpdateManyWithoutCustomersInput as OrderUpdateManyWithoutCustomersInput }; diff --git a/apps/ecommerce-server/src/customer/base/UpdateCustomerArgs.ts b/apps/ecommerce-server/src/customer/base/UpdateCustomerArgs.ts index e36575f..3ae26ea 100644 --- a/apps/ecommerce-server/src/customer/base/UpdateCustomerArgs.ts +++ b/apps/ecommerce-server/src/customer/base/UpdateCustomerArgs.ts @@ -21,4 +21,4 @@ class UpdateCustomerArgs { data!: CustomerUpdateInput; } -export { UpdateCustomerArgs }; +export { UpdateCustomerArgs as UpdateCustomerArgs }; diff --git a/apps/ecommerce-server/src/customer/base/customer.module.base.ts b/apps/ecommerce-server/src/customer/base/customer.module.base.ts index 3816731..a0f040a 100644 --- a/apps/ecommerce-server/src/customer/base/customer.module.base.ts +++ b/apps/ecommerce-server/src/customer/base/customer.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class CustomerModuleBase {} diff --git a/apps/ecommerce-server/src/customer/base/customer.resolver.base.ts b/apps/ecommerce-server/src/customer/base/customer.resolver.base.ts index 94a0e21..e9f6566 100644 --- a/apps/ecommerce-server/src/customer/base/customer.resolver.base.ts +++ b/apps/ecommerce-server/src/customer/base/customer.resolver.base.ts @@ -9,14 +9,14 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as apollo from "apollo-server-express"; -import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; -import * as gqlACGuard from "../../auth/gqlAC.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import { MetaQueryPayload } from "../../util/MetaQueryPayload"; +import * as nestAccessControl from "nest-access-control"; +import * as gqlACGuard from "../../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { CreateCustomerArgs } from "./CreateCustomerArgs"; @@ -29,9 +29,8 @@ import { OrderFindManyArgs } from "../../order/base/OrderFindManyArgs"; import { Order } from "../../order/base/Order"; import { Address } from "../../address/base/Address"; import { CustomerService } from "../customer.service"; - -@graphql.Resolver(() => Customer) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Customer) export class CustomerResolverBase { constructor( protected readonly service: CustomerService, diff --git a/apps/ecommerce-server/src/customer/customer.resolver.ts b/apps/ecommerce-server/src/customer/customer.resolver.ts index 83897f9..1113ac5 100644 --- a/apps/ecommerce-server/src/customer/customer.resolver.ts +++ b/apps/ecommerce-server/src/customer/customer.resolver.ts @@ -1,14 +1,14 @@ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; import * as gqlACGuard from "../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { CustomerResolverBase } from "./base/customer.resolver.base"; import { Customer } from "./base/Customer"; import { CustomerService } from "./customer.service"; -@graphql.Resolver(() => Customer) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Customer) export class CustomerResolver extends CustomerResolverBase { constructor( protected readonly service: CustomerService, diff --git a/apps/ecommerce-server/src/grants.json b/apps/ecommerce-server/src/grants.json index a9e8ea6..92e13ae 100644 --- a/apps/ecommerce-server/src/grants.json +++ b/apps/ecommerce-server/src/grants.json @@ -149,4 +149,4 @@ "action": "read:any", "attributes": "*" } -] \ No newline at end of file +] diff --git a/apps/ecommerce-server/src/order/base/CreateOrderArgs.ts b/apps/ecommerce-server/src/order/base/CreateOrderArgs.ts index dc49e44..69cf061 100644 --- a/apps/ecommerce-server/src/order/base/CreateOrderArgs.ts +++ b/apps/ecommerce-server/src/order/base/CreateOrderArgs.ts @@ -18,4 +18,4 @@ class CreateOrderArgs { data!: OrderCreateInput; } -export { CreateOrderArgs }; +export { CreateOrderArgs as CreateOrderArgs }; diff --git a/apps/ecommerce-server/src/order/base/DeleteOrderArgs.ts b/apps/ecommerce-server/src/order/base/DeleteOrderArgs.ts index 1a3da8a..84f98ff 100644 --- a/apps/ecommerce-server/src/order/base/DeleteOrderArgs.ts +++ b/apps/ecommerce-server/src/order/base/DeleteOrderArgs.ts @@ -18,4 +18,4 @@ class DeleteOrderArgs { where!: OrderWhereUniqueInput; } -export { DeleteOrderArgs }; +export { DeleteOrderArgs as DeleteOrderArgs }; diff --git a/apps/ecommerce-server/src/order/base/Order.ts b/apps/ecommerce-server/src/order/base/Order.ts index 708f5c6..634a2d1 100644 --- a/apps/ecommerce-server/src/order/base/Order.ts +++ b/apps/ecommerce-server/src/order/base/Order.ts @@ -101,4 +101,4 @@ class Order { updatedAt!: Date; } -export { Order }; +export { Order as Order }; diff --git a/apps/ecommerce-server/src/order/base/OrderCreateInput.ts b/apps/ecommerce-server/src/order/base/OrderCreateInput.ts index b0bbdf1..35dc32b 100644 --- a/apps/ecommerce-server/src/order/base/OrderCreateInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderCreateInput.ts @@ -76,4 +76,4 @@ class OrderCreateInput { totalPrice?: number | null; } -export { OrderCreateInput }; +export { OrderCreateInput as OrderCreateInput }; diff --git a/apps/ecommerce-server/src/order/base/OrderFindManyArgs.ts b/apps/ecommerce-server/src/order/base/OrderFindManyArgs.ts index 69fe9e4..bb3a980 100644 --- a/apps/ecommerce-server/src/order/base/OrderFindManyArgs.ts +++ b/apps/ecommerce-server/src/order/base/OrderFindManyArgs.ts @@ -50,4 +50,4 @@ class OrderFindManyArgs { take?: number; } -export { OrderFindManyArgs }; +export { OrderFindManyArgs as OrderFindManyArgs }; diff --git a/apps/ecommerce-server/src/order/base/OrderFindUniqueArgs.ts b/apps/ecommerce-server/src/order/base/OrderFindUniqueArgs.ts index 799e15d..e14453e 100644 --- a/apps/ecommerce-server/src/order/base/OrderFindUniqueArgs.ts +++ b/apps/ecommerce-server/src/order/base/OrderFindUniqueArgs.ts @@ -18,4 +18,4 @@ class OrderFindUniqueArgs { where!: OrderWhereUniqueInput; } -export { OrderFindUniqueArgs }; +export { OrderFindUniqueArgs as OrderFindUniqueArgs }; diff --git a/apps/ecommerce-server/src/order/base/OrderListRelationFilter.ts b/apps/ecommerce-server/src/order/base/OrderListRelationFilter.ts index 5f6c9f5..0ecb03a 100644 --- a/apps/ecommerce-server/src/order/base/OrderListRelationFilter.ts +++ b/apps/ecommerce-server/src/order/base/OrderListRelationFilter.ts @@ -53,4 +53,4 @@ class OrderListRelationFilter { }) none?: OrderWhereInput; } -export { OrderListRelationFilter }; +export { OrderListRelationFilter as OrderListRelationFilter }; diff --git a/apps/ecommerce-server/src/order/base/OrderOrderByInput.ts b/apps/ecommerce-server/src/order/base/OrderOrderByInput.ts index 2ed3c98..7644f7f 100644 --- a/apps/ecommerce-server/src/order/base/OrderOrderByInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderOrderByInput.ts @@ -91,4 +91,4 @@ class OrderOrderByInput { updatedAt?: SortOrder; } -export { OrderOrderByInput }; +export { OrderOrderByInput as OrderOrderByInput }; diff --git a/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts b/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts index 007f95c..6749f39 100644 --- a/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderUpdateInput.ts @@ -76,4 +76,4 @@ class OrderUpdateInput { totalPrice?: number | null; } -export { OrderUpdateInput }; +export { OrderUpdateInput as OrderUpdateInput }; diff --git a/apps/ecommerce-server/src/order/base/OrderWhereInput.ts b/apps/ecommerce-server/src/order/base/OrderWhereInput.ts index 62b0a3f..376134b 100644 --- a/apps/ecommerce-server/src/order/base/OrderWhereInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderWhereInput.ts @@ -90,4 +90,4 @@ class OrderWhereInput { totalPrice?: IntNullableFilter; } -export { OrderWhereInput }; +export { OrderWhereInput as OrderWhereInput }; diff --git a/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts b/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts index 1991d03..04690e2 100644 --- a/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/order/base/OrderWhereUniqueInput.ts @@ -24,4 +24,4 @@ class OrderWhereUniqueInput { id!: string; } -export { OrderWhereUniqueInput }; +export { OrderWhereUniqueInput as OrderWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/order/base/UpdateOrderArgs.ts b/apps/ecommerce-server/src/order/base/UpdateOrderArgs.ts index 536678c..ba59c91 100644 --- a/apps/ecommerce-server/src/order/base/UpdateOrderArgs.ts +++ b/apps/ecommerce-server/src/order/base/UpdateOrderArgs.ts @@ -21,4 +21,4 @@ class UpdateOrderArgs { data!: OrderUpdateInput; } -export { UpdateOrderArgs }; +export { UpdateOrderArgs as UpdateOrderArgs }; diff --git a/apps/ecommerce-server/src/order/base/order.module.base.ts b/apps/ecommerce-server/src/order/base/order.module.base.ts index 6e3d1f3..de24ca1 100644 --- a/apps/ecommerce-server/src/order/base/order.module.base.ts +++ b/apps/ecommerce-server/src/order/base/order.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class OrderModuleBase {} diff --git a/apps/ecommerce-server/src/order/base/order.resolver.base.ts b/apps/ecommerce-server/src/order/base/order.resolver.base.ts index 6bff0d9..192d875 100644 --- a/apps/ecommerce-server/src/order/base/order.resolver.base.ts +++ b/apps/ecommerce-server/src/order/base/order.resolver.base.ts @@ -9,14 +9,14 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as apollo from "apollo-server-express"; -import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; -import * as gqlACGuard from "../../auth/gqlAC.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import { MetaQueryPayload } from "../../util/MetaQueryPayload"; +import * as nestAccessControl from "nest-access-control"; +import * as gqlACGuard from "../../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { CreateOrderArgs } from "./CreateOrderArgs"; @@ -28,9 +28,8 @@ import { Order } from "./Order"; import { Customer } from "../../customer/base/Customer"; import { Product } from "../../product/base/Product"; import { OrderService } from "../order.service"; - -@graphql.Resolver(() => Order) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Order) export class OrderResolverBase { constructor( protected readonly service: OrderService, diff --git a/apps/ecommerce-server/src/order/order.resolver.ts b/apps/ecommerce-server/src/order/order.resolver.ts index bea989c..f5dfa6f 100644 --- a/apps/ecommerce-server/src/order/order.resolver.ts +++ b/apps/ecommerce-server/src/order/order.resolver.ts @@ -1,14 +1,14 @@ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; import * as gqlACGuard from "../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { OrderResolverBase } from "./base/order.resolver.base"; import { Order } from "./base/Order"; import { OrderService } from "./order.service"; -@graphql.Resolver(() => Order) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Order) export class OrderResolver extends OrderResolverBase { constructor( protected readonly service: OrderService, diff --git a/apps/ecommerce-server/src/product/base/CreateProductArgs.ts b/apps/ecommerce-server/src/product/base/CreateProductArgs.ts index 7870216..5facac3 100644 --- a/apps/ecommerce-server/src/product/base/CreateProductArgs.ts +++ b/apps/ecommerce-server/src/product/base/CreateProductArgs.ts @@ -18,4 +18,4 @@ class CreateProductArgs { data!: ProductCreateInput; } -export { CreateProductArgs }; +export { CreateProductArgs as CreateProductArgs }; diff --git a/apps/ecommerce-server/src/product/base/DeleteProductArgs.ts b/apps/ecommerce-server/src/product/base/DeleteProductArgs.ts index 28d76bf..7f1a5f8 100644 --- a/apps/ecommerce-server/src/product/base/DeleteProductArgs.ts +++ b/apps/ecommerce-server/src/product/base/DeleteProductArgs.ts @@ -18,4 +18,4 @@ class DeleteProductArgs { where!: ProductWhereUniqueInput; } -export { DeleteProductArgs }; +export { DeleteProductArgs as DeleteProductArgs }; diff --git a/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts b/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts index cb48bcf..7045d20 100644 --- a/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts +++ b/apps/ecommerce-server/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts @@ -25,4 +25,4 @@ class OrderCreateNestedManyWithoutProductsInput { connect?: Array; } -export { OrderCreateNestedManyWithoutProductsInput }; +export { OrderCreateNestedManyWithoutProductsInput as OrderCreateNestedManyWithoutProductsInput }; diff --git a/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts b/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts index 70fa067..b9e6b5c 100644 --- a/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts +++ b/apps/ecommerce-server/src/product/base/OrderUpdateManyWithoutProductsInput.ts @@ -43,4 +43,4 @@ class OrderUpdateManyWithoutProductsInput { set?: Array; } -export { OrderUpdateManyWithoutProductsInput }; +export { OrderUpdateManyWithoutProductsInput as OrderUpdateManyWithoutProductsInput }; diff --git a/apps/ecommerce-server/src/product/base/Product.ts b/apps/ecommerce-server/src/product/base/Product.ts index 4a3a8b0..23d6c6b 100644 --- a/apps/ecommerce-server/src/product/base/Product.ts +++ b/apps/ecommerce-server/src/product/base/Product.ts @@ -90,4 +90,4 @@ class Product { updatedAt!: Date; } -export { Product }; +export { Product as Product }; diff --git a/apps/ecommerce-server/src/product/base/ProductCreateInput.ts b/apps/ecommerce-server/src/product/base/ProductCreateInput.ts index e835912..9e5ee94 100644 --- a/apps/ecommerce-server/src/product/base/ProductCreateInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductCreateInput.ts @@ -68,4 +68,4 @@ class ProductCreateInput { orders?: OrderCreateNestedManyWithoutProductsInput; } -export { ProductCreateInput }; +export { ProductCreateInput as ProductCreateInput }; diff --git a/apps/ecommerce-server/src/product/base/ProductFindManyArgs.ts b/apps/ecommerce-server/src/product/base/ProductFindManyArgs.ts index 3564904..a124a63 100644 --- a/apps/ecommerce-server/src/product/base/ProductFindManyArgs.ts +++ b/apps/ecommerce-server/src/product/base/ProductFindManyArgs.ts @@ -50,4 +50,4 @@ class ProductFindManyArgs { take?: number; } -export { ProductFindManyArgs }; +export { ProductFindManyArgs as ProductFindManyArgs }; diff --git a/apps/ecommerce-server/src/product/base/ProductFindUniqueArgs.ts b/apps/ecommerce-server/src/product/base/ProductFindUniqueArgs.ts index a6eafeb..3dabe2f 100644 --- a/apps/ecommerce-server/src/product/base/ProductFindUniqueArgs.ts +++ b/apps/ecommerce-server/src/product/base/ProductFindUniqueArgs.ts @@ -18,4 +18,4 @@ class ProductFindUniqueArgs { where!: ProductWhereUniqueInput; } -export { ProductFindUniqueArgs }; +export { ProductFindUniqueArgs as ProductFindUniqueArgs }; diff --git a/apps/ecommerce-server/src/product/base/ProductListRelationFilter.ts b/apps/ecommerce-server/src/product/base/ProductListRelationFilter.ts index 51589c9..cce7c64 100644 --- a/apps/ecommerce-server/src/product/base/ProductListRelationFilter.ts +++ b/apps/ecommerce-server/src/product/base/ProductListRelationFilter.ts @@ -53,4 +53,4 @@ class ProductListRelationFilter { }) none?: ProductWhereInput; } -export { ProductListRelationFilter }; +export { ProductListRelationFilter as ProductListRelationFilter }; diff --git a/apps/ecommerce-server/src/product/base/ProductOrderByInput.ts b/apps/ecommerce-server/src/product/base/ProductOrderByInput.ts index 22d1d79..a24c0a6 100644 --- a/apps/ecommerce-server/src/product/base/ProductOrderByInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductOrderByInput.ts @@ -73,4 +73,4 @@ class ProductOrderByInput { updatedAt?: SortOrder; } -export { ProductOrderByInput }; +export { ProductOrderByInput as ProductOrderByInput }; diff --git a/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts b/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts index 36f55d8..487240a 100644 --- a/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductUpdateInput.ts @@ -68,4 +68,4 @@ class ProductUpdateInput { orders?: OrderUpdateManyWithoutProductsInput; } -export { ProductUpdateInput }; +export { ProductUpdateInput as ProductUpdateInput }; diff --git a/apps/ecommerce-server/src/product/base/ProductWhereInput.ts b/apps/ecommerce-server/src/product/base/ProductWhereInput.ts index 32e3daf..31806fa 100644 --- a/apps/ecommerce-server/src/product/base/ProductWhereInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductWhereInput.ts @@ -77,4 +77,4 @@ class ProductWhereInput { orders?: OrderListRelationFilter; } -export { ProductWhereInput }; +export { ProductWhereInput as ProductWhereInput }; diff --git a/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts b/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts index 674b62d..b48170e 100644 --- a/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/product/base/ProductWhereUniqueInput.ts @@ -24,4 +24,4 @@ class ProductWhereUniqueInput { id!: string; } -export { ProductWhereUniqueInput }; +export { ProductWhereUniqueInput as ProductWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/product/base/UpdateProductArgs.ts b/apps/ecommerce-server/src/product/base/UpdateProductArgs.ts index 0a479f8..4607552 100644 --- a/apps/ecommerce-server/src/product/base/UpdateProductArgs.ts +++ b/apps/ecommerce-server/src/product/base/UpdateProductArgs.ts @@ -21,4 +21,4 @@ class UpdateProductArgs { data!: ProductUpdateInput; } -export { UpdateProductArgs }; +export { UpdateProductArgs as UpdateProductArgs }; diff --git a/apps/ecommerce-server/src/product/base/product.module.base.ts b/apps/ecommerce-server/src/product/base/product.module.base.ts index 0584450..9fb043f 100644 --- a/apps/ecommerce-server/src/product/base/product.module.base.ts +++ b/apps/ecommerce-server/src/product/base/product.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class ProductModuleBase {} diff --git a/apps/ecommerce-server/src/product/base/product.resolver.base.ts b/apps/ecommerce-server/src/product/base/product.resolver.base.ts index dcbaf64..cc76ac9 100644 --- a/apps/ecommerce-server/src/product/base/product.resolver.base.ts +++ b/apps/ecommerce-server/src/product/base/product.resolver.base.ts @@ -9,14 +9,14 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as apollo from "apollo-server-express"; -import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; -import * as gqlACGuard from "../../auth/gqlAC.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import { MetaQueryPayload } from "../../util/MetaQueryPayload"; +import * as nestAccessControl from "nest-access-control"; +import * as gqlACGuard from "../../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { CreateProductArgs } from "./CreateProductArgs"; @@ -28,9 +28,8 @@ import { Product } from "./Product"; import { OrderFindManyArgs } from "../../order/base/OrderFindManyArgs"; import { Order } from "../../order/base/Order"; import { ProductService } from "../product.service"; - -@graphql.Resolver(() => Product) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Product) export class ProductResolverBase { constructor( protected readonly service: ProductService, diff --git a/apps/ecommerce-server/src/product/product.resolver.ts b/apps/ecommerce-server/src/product/product.resolver.ts index dc43a33..6a2afd0 100644 --- a/apps/ecommerce-server/src/product/product.resolver.ts +++ b/apps/ecommerce-server/src/product/product.resolver.ts @@ -1,14 +1,14 @@ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; import * as gqlACGuard from "../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { ProductResolverBase } from "./base/product.resolver.base"; import { Product } from "./base/Product"; import { ProductService } from "./product.service"; -@graphql.Resolver(() => Product) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => Product) export class ProductResolver extends ProductResolverBase { constructor( protected readonly service: ProductService, diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index c1994ee..b8a9ce1 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("9qih46fr") + .setVersion("nqy7krj5") .addBearerAuth() .build(); diff --git a/apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts b/apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts deleted file mode 100644 index 29ae042..0000000 --- a/apps/ecommerce-server/src/tests/auth/basic/basic.strategy.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { UnauthorizedException } from "@nestjs/common"; -import { mock } from "jest-mock-extended"; -import { AuthService } from "../../../auth/auth.service"; -import { BasicStrategyBase } from "../../../auth/basic/base/basic.strategy.base"; -import { TEST_USER } from "../constants"; - -describe("Testing the basicStrategyBase.validate()", () => { - const TEST_PASSWORD = "gabay"; - const authService = mock(); - const basicStrategy = new BasicStrategyBase(authService); - beforeEach(() => { - authService.validateUser.mockClear(); - }); - beforeAll(() => { - //ARRANGE - authService.validateUser - .calledWith(TEST_USER.username, TEST_PASSWORD) - .mockReturnValue(Promise.resolve(TEST_USER)); - }); - it("should return the user", async () => { - //ACT - const result = await basicStrategy.validate( - TEST_USER.username, - TEST_PASSWORD - ); - //ASSERT - expect(result).toBe(TEST_USER); - }); - it("should throw error if there is not valid user", async () => { - //ARRANGE - authService.validateUser.mockReturnValue(Promise.resolve(null)); - //ACT - const result = basicStrategy.validate("noUsername", TEST_PASSWORD); - //ASSERT - return expect(result).rejects.toThrowError(UnauthorizedException); - }); -}); diff --git a/apps/ecommerce-server/src/user/base/CreateUserArgs.ts b/apps/ecommerce-server/src/user/base/CreateUserArgs.ts index 4a1e644..24817ac 100644 --- a/apps/ecommerce-server/src/user/base/CreateUserArgs.ts +++ b/apps/ecommerce-server/src/user/base/CreateUserArgs.ts @@ -18,4 +18,4 @@ class CreateUserArgs { data!: UserCreateInput; } -export { CreateUserArgs }; +export { CreateUserArgs as CreateUserArgs }; diff --git a/apps/ecommerce-server/src/user/base/DeleteUserArgs.ts b/apps/ecommerce-server/src/user/base/DeleteUserArgs.ts index ec845b0..3649def 100644 --- a/apps/ecommerce-server/src/user/base/DeleteUserArgs.ts +++ b/apps/ecommerce-server/src/user/base/DeleteUserArgs.ts @@ -18,4 +18,4 @@ class DeleteUserArgs { where!: UserWhereUniqueInput; } -export { DeleteUserArgs }; +export { DeleteUserArgs as DeleteUserArgs }; diff --git a/apps/ecommerce-server/src/user/base/UpdateUserArgs.ts b/apps/ecommerce-server/src/user/base/UpdateUserArgs.ts index d2f133f..342f128 100644 --- a/apps/ecommerce-server/src/user/base/UpdateUserArgs.ts +++ b/apps/ecommerce-server/src/user/base/UpdateUserArgs.ts @@ -21,4 +21,4 @@ class UpdateUserArgs { data!: UserUpdateInput; } -export { UpdateUserArgs }; +export { UpdateUserArgs as UpdateUserArgs }; diff --git a/apps/ecommerce-server/src/user/base/User.ts b/apps/ecommerce-server/src/user/base/User.ts index 29aaa2d..0050859 100644 --- a/apps/ecommerce-server/src/user/base/User.ts +++ b/apps/ecommerce-server/src/user/base/User.ts @@ -80,4 +80,4 @@ class User { username!: string; } -export { User }; +export { User as User }; diff --git a/apps/ecommerce-server/src/user/base/UserCreateInput.ts b/apps/ecommerce-server/src/user/base/UserCreateInput.ts index 0e5ad32..adba25b 100644 --- a/apps/ecommerce-server/src/user/base/UserCreateInput.ts +++ b/apps/ecommerce-server/src/user/base/UserCreateInput.ts @@ -63,4 +63,4 @@ class UserCreateInput { username!: string; } -export { UserCreateInput }; +export { UserCreateInput as UserCreateInput }; diff --git a/apps/ecommerce-server/src/user/base/UserFindManyArgs.ts b/apps/ecommerce-server/src/user/base/UserFindManyArgs.ts index 07ffdab..11525da 100644 --- a/apps/ecommerce-server/src/user/base/UserFindManyArgs.ts +++ b/apps/ecommerce-server/src/user/base/UserFindManyArgs.ts @@ -50,4 +50,4 @@ class UserFindManyArgs { take?: number; } -export { UserFindManyArgs }; +export { UserFindManyArgs as UserFindManyArgs }; diff --git a/apps/ecommerce-server/src/user/base/UserFindUniqueArgs.ts b/apps/ecommerce-server/src/user/base/UserFindUniqueArgs.ts index 3767539..b7810d2 100644 --- a/apps/ecommerce-server/src/user/base/UserFindUniqueArgs.ts +++ b/apps/ecommerce-server/src/user/base/UserFindUniqueArgs.ts @@ -18,4 +18,4 @@ class UserFindUniqueArgs { where!: UserWhereUniqueInput; } -export { UserFindUniqueArgs }; +export { UserFindUniqueArgs as UserFindUniqueArgs }; diff --git a/apps/ecommerce-server/src/user/base/UserListRelationFilter.ts b/apps/ecommerce-server/src/user/base/UserListRelationFilter.ts index 4c57721..0ff7d94 100644 --- a/apps/ecommerce-server/src/user/base/UserListRelationFilter.ts +++ b/apps/ecommerce-server/src/user/base/UserListRelationFilter.ts @@ -53,4 +53,4 @@ class UserListRelationFilter { }) none?: UserWhereInput; } -export { UserListRelationFilter }; +export { UserListRelationFilter as UserListRelationFilter }; diff --git a/apps/ecommerce-server/src/user/base/UserOrderByInput.ts b/apps/ecommerce-server/src/user/base/UserOrderByInput.ts index 07baa8d..849a0c3 100644 --- a/apps/ecommerce-server/src/user/base/UserOrderByInput.ts +++ b/apps/ecommerce-server/src/user/base/UserOrderByInput.ts @@ -91,4 +91,4 @@ class UserOrderByInput { username?: SortOrder; } -export { UserOrderByInput }; +export { UserOrderByInput as UserOrderByInput }; diff --git a/apps/ecommerce-server/src/user/base/UserUpdateInput.ts b/apps/ecommerce-server/src/user/base/UserUpdateInput.ts index 73a0141..5e77d9f 100644 --- a/apps/ecommerce-server/src/user/base/UserUpdateInput.ts +++ b/apps/ecommerce-server/src/user/base/UserUpdateInput.ts @@ -72,4 +72,4 @@ class UserUpdateInput { username?: string; } -export { UserUpdateInput }; +export { UserUpdateInput as UserUpdateInput }; diff --git a/apps/ecommerce-server/src/user/base/UserWhereInput.ts b/apps/ecommerce-server/src/user/base/UserWhereInput.ts index fd59ab5..a8babc1 100644 --- a/apps/ecommerce-server/src/user/base/UserWhereInput.ts +++ b/apps/ecommerce-server/src/user/base/UserWhereInput.ts @@ -63,4 +63,4 @@ class UserWhereInput { username?: StringFilter; } -export { UserWhereInput }; +export { UserWhereInput as UserWhereInput }; diff --git a/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts b/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts index c711460..0bcea12 100644 --- a/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts +++ b/apps/ecommerce-server/src/user/base/UserWhereUniqueInput.ts @@ -24,4 +24,4 @@ class UserWhereUniqueInput { id!: string; } -export { UserWhereUniqueInput }; +export { UserWhereUniqueInput as UserWhereUniqueInput }; diff --git a/apps/ecommerce-server/src/user/base/user.module.base.ts b/apps/ecommerce-server/src/user/base/user.module.base.ts index ed8ce8d..76d29fe 100644 --- a/apps/ecommerce-server/src/user/base/user.module.base.ts +++ b/apps/ecommerce-server/src/user/base/user.module.base.ts @@ -13,10 +13,8 @@ import { Module, forwardRef } from "@nestjs/common"; import { MorganModule } from "nest-morgan"; import { ACLModule } from "../../auth/acl.module"; import { AuthModule } from "../../auth/auth.module"; - @Module({ imports: [ACLModule, forwardRef(() => AuthModule), MorganModule], - exports: [ACLModule, AuthModule, MorganModule], }) export class UserModuleBase {} diff --git a/apps/ecommerce-server/src/user/base/user.resolver.base.ts b/apps/ecommerce-server/src/user/base/user.resolver.base.ts index c6f23df..614a584 100644 --- a/apps/ecommerce-server/src/user/base/user.resolver.base.ts +++ b/apps/ecommerce-server/src/user/base/user.resolver.base.ts @@ -9,14 +9,14 @@ https://docs.amplication.com/how-to/custom-code ------------------------------------------------------------------------------ */ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as apollo from "apollo-server-express"; -import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; -import * as gqlACGuard from "../../auth/gqlAC.guard"; import { isRecordNotFoundError } from "../../prisma.util"; import { MetaQueryPayload } from "../../util/MetaQueryPayload"; +import * as nestAccessControl from "nest-access-control"; +import * as gqlACGuard from "../../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor"; import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor"; import { CreateUserArgs } from "./CreateUserArgs"; @@ -26,9 +26,8 @@ import { UserFindManyArgs } from "./UserFindManyArgs"; import { UserFindUniqueArgs } from "./UserFindUniqueArgs"; import { User } from "./User"; import { UserService } from "../user.service"; - -@graphql.Resolver(() => User) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => User) export class UserResolverBase { constructor( protected readonly service: UserService, diff --git a/apps/ecommerce-server/src/user/user.resolver.ts b/apps/ecommerce-server/src/user/user.resolver.ts index 24d8558..bc3a79b 100644 --- a/apps/ecommerce-server/src/user/user.resolver.ts +++ b/apps/ecommerce-server/src/user/user.resolver.ts @@ -1,14 +1,14 @@ -import * as common from "@nestjs/common"; import * as graphql from "@nestjs/graphql"; import * as nestAccessControl from "nest-access-control"; -import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; import * as gqlACGuard from "../auth/gqlAC.guard"; +import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; +import * as common from "@nestjs/common"; import { UserResolverBase } from "./base/user.resolver.base"; import { User } from "./base/User"; import { UserService } from "./user.service"; -@graphql.Resolver(() => User) @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) +@graphql.Resolver(() => User) export class UserResolver extends UserResolverBase { constructor( protected readonly service: UserService, diff --git a/apps/ecommerce-server/src/user/user.service.ts b/apps/ecommerce-server/src/user/user.service.ts index 2d7ade5..a8e4508 100644 --- a/apps/ecommerce-server/src/user/user.service.ts +++ b/apps/ecommerce-server/src/user/user.service.ts @@ -1,7 +1,7 @@ import { Injectable } from "@nestjs/common"; import { PrismaService } from "../prisma/prisma.service"; -import { UserServiceBase } from "./base/user.service.base"; import { PasswordService } from "../auth/password.service"; +import { UserServiceBase } from "./base/user.service.base"; @Injectable() export class UserService extends UserServiceBase { From 6761b298dd4078a84af3633a06225e0ba493ae2c Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 15:40:05 +0000 Subject: [PATCH 80/85] Amplication build # clh6fpsc7000ycg01k1qtgm3m. Commit message: https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbozbamx00noj301wjlnxivl/builds/clh6fpsc7000ycg01k1qtgm3m --- apps/logistic-server/.env | 3 +- apps/logistic-server/docker-compose.db.yml | 12 +++++ apps/logistic-server/docker-compose.yml | 6 +-- apps/logistic-server/package.json | 25 ++++++----- .../src/auth/password.service.spec.ts | 12 +++-- apps/logistic-server/src/swagger.ts | 2 +- apps/logistic-server/src/user/base/User.ts | 5 ++- .../src/user/base/UserCreateInput.ts | 5 ++- .../src/user/base/UserUpdateInput.ts | 5 ++- apps/logistic-server/src/validators/index.ts | 1 + .../is-json-value-validator.spec.ts | 44 +++++++++++++++++++ .../src/validators/is-json-value-validator.ts | 29 ++++++++++++ apps/logistic-server/tsconfig.json | 6 ++- 13 files changed, 128 insertions(+), 27 deletions(-) create mode 100644 apps/logistic-server/src/validators/index.ts create mode 100644 apps/logistic-server/src/validators/is-json-value-validator.spec.ts create mode 100644 apps/logistic-server/src/validators/is-json-value-validator.ts diff --git a/apps/logistic-server/.env b/apps/logistic-server/.env index 40b1072..d45c501 100644 --- a/apps/logistic-server/.env +++ b/apps/logistic-server/.env @@ -4,7 +4,8 @@ PORT=3000 DB_USER=root DB_PASSWORD=admin DB_PORT=3306 -DB_URL=mysql://root:admin@localhost:3306/logistic +DB_NAME=my-db +DB_URL=mysql://root:admin@localhost:3306/my-db KAFKA_BROKERS=localhost:9092 KAFKA_ENABLE_SSL=false KAFKA_CLIENT_ID=logistic diff --git a/apps/logistic-server/docker-compose.db.yml b/apps/logistic-server/docker-compose.db.yml index abda133..a599fde 100644 --- a/apps/logistic-server/docker-compose.db.yml +++ b/apps/logistic-server/docker-compose.db.yml @@ -8,6 +8,18 @@ services: - ${DB_PORT}:3306 environment: MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} + healthcheck: + test: + - CMD + - mysqladmin + - ping + - -h + - localhost + - -u + - ${DB_USER} + timeout: 45s + interval: 10s + retries: 10 adminer: image: adminer restart: always diff --git a/apps/logistic-server/docker-compose.yml b/apps/logistic-server/docker-compose.yml index 004adbd..1a13930 100644 --- a/apps/logistic-server/docker-compose.yml +++ b/apps/logistic-server/docker-compose.yml @@ -11,7 +11,7 @@ services: BCRYPT_SALT: ${BCRYPT_SALT} JWT_SECRET_KEY: ${JWT_SECRET_KEY} JWT_EXPIRATION: ${JWT_EXPIRATION} - DB_URL: mysql://${DB_USER}:${DB_PASSWORD}@db:3306 + DB_URL: mysql://${DB_USER}:${DB_PASSWORD}@db:3306/${DB_NAME} depends_on: - migrate migrate: @@ -23,7 +23,7 @@ services: working_dir: /app/server environment: BCRYPT_SALT: ${BCRYPT_SALT} - DB_URL: mysql://${DB_USER}:${DB_PASSWORD}@db:3306 + DB_URL: mysql://${DB_USER}:${DB_PASSWORD}@db:3306/${DB_NAME} depends_on: db: condition: service_healthy @@ -39,7 +39,7 @@ services: ports: - ${DB_PORT}:3306 environment: - DB_ROOT_PASSWORD: ${DB_PASSWORD} + MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} healthcheck: test: - CMD diff --git a/apps/logistic-server/package.json b/apps/logistic-server/package.json index c479b39..06f32c1 100644 --- a/apps/logistic-server/package.json +++ b/apps/logistic-server/package.json @@ -1,6 +1,5 @@ { - "name": "@sample-application/server", - "version": "0.1.3", + "name": "@logistic/server", "private": true, "scripts": { "start": "nest start", @@ -24,8 +23,6 @@ "@nestjs/config": "1.1.5", "@nestjs/core": "8.4.7", "@nestjs/graphql": "9.1.2", - "@nestjs/jwt": "8.0.0", - "@nestjs/passport": "8.2.2", "@nestjs/platform-express": "8.4.7", "@nestjs/serve-static": "2.2.2", "@nestjs/swagger": "5.1.5", @@ -40,12 +37,17 @@ "nest-morgan": "1.0.1", "nestjs-prisma": "0.19.0", "npm-run-all": "4.1.5", - "passport": "0.6.0", - "passport-http": "0.3.0", - "passport-jwt": "4.0.0", "reflect-metadata": "0.1.13", "swagger-ui-express": "4.3.0", - "ts-node": "9.1.1" + "ts-node": "10.9.1", + "validator": "^13.9.0", + "@nestjs/microservices": "8.2.3", + "kafkajs": "2.2.0", + "@nestjs/jwt": "^10.0.2", + "@nestjs/passport": "^9.0.0", + "passport": "0.6.0", + "passport-http": "0.3.0", + "passport-jwt": "4.0.1" }, "devDependencies": { "@nestjs/cli": "8.2.5", @@ -55,16 +57,17 @@ "@types/graphql-type-json": "0.3.2", "@types/jest": "26.0.19", "@types/normalize-path": "3.0.0", - "@types/passport-http": "0.3.9", - "@types/passport-jwt": "3.0.6", "@types/supertest": "2.0.11", + "@types/validator": "^13.7.15", "jest": "27.0.6", "jest-mock-extended": "^2.0.4", "prisma": "4.6.1", "supertest": "4.0.2", "ts-jest": "27.0.3", "type-fest": "0.11.0", - "typescript": "4.2.3" + "typescript": "4.2.3", + "@types/passport-http": "0.3.9", + "@types/passport-jwt": "3.0.8" }, "jest": { "preset": "ts-jest", diff --git a/apps/logistic-server/src/auth/password.service.spec.ts b/apps/logistic-server/src/auth/password.service.spec.ts index 79c5a44..309c8c0 100644 --- a/apps/logistic-server/src/auth/password.service.spec.ts +++ b/apps/logistic-server/src/auth/password.service.spec.ts @@ -1,7 +1,6 @@ import { ConfigService } from "@nestjs/config"; import { Test, TestingModule } from "@nestjs/testing"; import { PasswordService } from "./password.service"; -import * as bcrypt from "bcrypt"; const EXAMPLE_PASSWORD = "examplePassword"; const EXAMPLE_HASHED_PASSWORD = "exampleHashedPassword"; @@ -12,11 +11,16 @@ const configServiceGetMock = jest.fn(() => { return EXAMPLE_SALT_OR_ROUNDS; }); -jest.mock("bcrypt"); +jest.mock("bcrypt", () => ({ + hash: jest.fn(), + compare: jest.fn(), +})); -bcrypt.hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); +const { hash, compare } = jest.requireMock("bcrypt"); -bcrypt.compare.mockImplementation(async () => true); +hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); + +compare.mockImplementation(async () => true); describe("PasswordService", () => { let service: PasswordService; diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 71ef2ac..f2949ee 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("nqy7krj5") + .setVersion("auewd2vm") .addBearerAuth() .build(); diff --git a/apps/logistic-server/src/user/base/User.ts b/apps/logistic-server/src/user/base/User.ts index 0050859..45adebe 100644 --- a/apps/logistic-server/src/user/base/User.ts +++ b/apps/logistic-server/src/user/base/User.ts @@ -11,8 +11,9 @@ https://docs.amplication.com/how-to/custom-code */ import { ObjectType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import { IsDate, IsString, IsOptional, IsJSON } from "class-validator"; +import { IsDate, IsString, IsOptional } from "class-validator"; import { Type } from "class-transformer"; +import { IsJSONValue } from "@app/custom-validators"; import { GraphQLJSON } from "graphql-type-json"; import { JsonValue } from "type-fest"; @@ -59,7 +60,7 @@ class User { @ApiProperty({ required: true, }) - @IsJSON() + @IsJSONValue() @Field(() => GraphQLJSON) roles!: JsonValue; diff --git a/apps/logistic-server/src/user/base/UserCreateInput.ts b/apps/logistic-server/src/user/base/UserCreateInput.ts index adba25b..6896f2a 100644 --- a/apps/logistic-server/src/user/base/UserCreateInput.ts +++ b/apps/logistic-server/src/user/base/UserCreateInput.ts @@ -11,7 +11,8 @@ https://docs.amplication.com/how-to/custom-code */ import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import { IsString, IsOptional, IsJSON } from "class-validator"; +import { IsString, IsOptional } from "class-validator"; +import { IsJSONValue } from "@app/custom-validators"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; @@ -50,7 +51,7 @@ class UserCreateInput { @ApiProperty({ required: true, }) - @IsJSON() + @IsJSONValue() @Field(() => GraphQLJSON) roles!: InputJsonValue; diff --git a/apps/logistic-server/src/user/base/UserUpdateInput.ts b/apps/logistic-server/src/user/base/UserUpdateInput.ts index 5e77d9f..b6e0e21 100644 --- a/apps/logistic-server/src/user/base/UserUpdateInput.ts +++ b/apps/logistic-server/src/user/base/UserUpdateInput.ts @@ -11,7 +11,8 @@ https://docs.amplication.com/how-to/custom-code */ import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import { IsString, IsOptional, IsJSON } from "class-validator"; +import { IsString, IsOptional } from "class-validator"; +import { IsJSONValue } from "@app/custom-validators"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; @@ -53,7 +54,7 @@ class UserUpdateInput { @ApiProperty({ required: false, }) - @IsJSON() + @IsJSONValue() @IsOptional() @Field(() => GraphQLJSON, { nullable: true, diff --git a/apps/logistic-server/src/validators/index.ts b/apps/logistic-server/src/validators/index.ts new file mode 100644 index 0000000..7f62d84 --- /dev/null +++ b/apps/logistic-server/src/validators/index.ts @@ -0,0 +1 @@ +export * from "./is-json-value-validator"; diff --git a/apps/logistic-server/src/validators/is-json-value-validator.spec.ts b/apps/logistic-server/src/validators/is-json-value-validator.spec.ts new file mode 100644 index 0000000..5a77824 --- /dev/null +++ b/apps/logistic-server/src/validators/is-json-value-validator.spec.ts @@ -0,0 +1,44 @@ +import { validate, ValidationError } from "class-validator"; +import { IsJSONValue } from "./is-json-value-validator"; + +class TestClass { + @IsJSONValue() + jsonProperty: unknown; +} + +describe("IsJSONValue", () => { + it("should validate a valid JSON string", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = '{"name": "John", "age": 30}'; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(0); + }); + + it("should not validate an invalid JSON string", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = '{name: "John", age: 30}'; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(1); + }); + + it("should not validate an invalid JSON string", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = "John"; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(1); + }); + + it("should validate a valid JSON object", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = { name: "John", age: 30 }; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(0); + }); + + it("should validate a valid JSON array", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = ["John", "30"]; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(0); + }); +}); diff --git a/apps/logistic-server/src/validators/is-json-value-validator.ts b/apps/logistic-server/src/validators/is-json-value-validator.ts new file mode 100644 index 0000000..7b96b4a --- /dev/null +++ b/apps/logistic-server/src/validators/is-json-value-validator.ts @@ -0,0 +1,29 @@ +import { + ValidationArguments, + registerDecorator, + ValidationOptions, +} from "class-validator"; +import isJSONValidator from "validator/lib/isJSON"; + +export function IsJSONValue(validationOptions?: ValidationOptions) { + return function (object: Object, propertyName: string) { + registerDecorator({ + name: "IsJSONValue", + target: object.constructor, + propertyName: propertyName, + options: validationOptions, + validator: { + validate(value: any, args: ValidationArguments) { + if (typeof value === "string") { + return isJSONValidator(value); + } + + return isJSONValidator(JSON.stringify(value)); + }, + defaultMessage(args: ValidationArguments): string { + return `${args.property} must be a valid json`; + }, + }, + }); + }; +} diff --git a/apps/logistic-server/tsconfig.json b/apps/logistic-server/tsconfig.json index ff90c46..f084cf7 100644 --- a/apps/logistic-server/tsconfig.json +++ b/apps/logistic-server/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": "./", "module": "commonjs", "declaration": false, "removeComments": true, @@ -14,7 +15,10 @@ "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "skipLibCheck": true, - "strict": true + "strict": true, + "paths": { + "@app/custom-validators": ["src/validators"] + } }, "include": ["src"] } From 774aab863638aca27eb65ad0554f8b4c1c4b92f3 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 15:40:18 +0000 Subject: [PATCH 81/85] Amplication build # clh6fpsc8001tcg013twektsi. Commit message: https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbox9qt800t6nm017tzaup5o/builds/clh6fpsc8001tcg013twektsi --- apps/ecommerce-server/.env | 3 +- apps/ecommerce-server/docker-compose.yml | 14 +++--- apps/ecommerce-server/package.json | 25 ++++++----- .../src/auth/password.service.spec.ts | 12 +++-- apps/ecommerce-server/src/swagger.ts | 2 +- apps/ecommerce-server/src/user/base/User.ts | 5 ++- .../src/user/base/UserCreateInput.ts | 5 ++- .../src/user/base/UserUpdateInput.ts | 5 ++- apps/ecommerce-server/src/validators/index.ts | 1 + .../is-json-value-validator.spec.ts | 44 +++++++++++++++++++ .../src/validators/is-json-value-validator.ts | 29 ++++++++++++ apps/ecommerce-server/tsconfig.json | 6 ++- 12 files changed, 118 insertions(+), 33 deletions(-) create mode 100644 apps/ecommerce-server/src/validators/index.ts create mode 100644 apps/ecommerce-server/src/validators/is-json-value-validator.spec.ts create mode 100644 apps/ecommerce-server/src/validators/is-json-value-validator.ts diff --git a/apps/ecommerce-server/.env b/apps/ecommerce-server/.env index 1edc26c..702d948 100644 --- a/apps/ecommerce-server/.env +++ b/apps/ecommerce-server/.env @@ -1,10 +1,11 @@ BCRYPT_SALT=10 COMPOSE_PROJECT_NAME=amp_clbox9qt800t6nm017tzaup5o PORT=3000 +DB_URL=postgres://admin:admin@localhost:5432/my-db DB_USER=admin DB_PASSWORD=admin DB_PORT=5432 -DB_URL=postgres://admin:admin@localhost:5432 +DB_NAME=my-db KAFKA_BROKERS=localhost:9092 KAFKA_ENABLE_SSL=false KAFKA_CLIENT_ID=ecommerce diff --git a/apps/ecommerce-server/docker-compose.yml b/apps/ecommerce-server/docker-compose.yml index bbfcf67..06dfbf5 100644 --- a/apps/ecommerce-server/docker-compose.yml +++ b/apps/ecommerce-server/docker-compose.yml @@ -11,7 +11,7 @@ services: BCRYPT_SALT: ${BCRYPT_SALT} JWT_SECRET_KEY: ${JWT_SECRET_KEY} JWT_EXPIRATION: ${JWT_EXPIRATION} - DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:${DB_PORT} + DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:5432/${DB_NAME} depends_on: - migrate migrate: @@ -23,7 +23,7 @@ services: working_dir: /app/server environment: BCRYPT_SALT: ${BCRYPT_SALT} - DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:${DB_PORT} + DB_URL: postgres://${DB_USER}:${DB_PASSWORD}@db:5432/${DB_NAME} depends_on: db: condition: service_healthy @@ -34,17 +34,13 @@ services: environment: POSTGRES_USER: ${DB_USER} POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_DB: ${DB_NAME} volumes: - postgres:/var/lib/postgresql/data healthcheck: test: - - CMD - - pg_isready - - -q - - -d - - ${DB_NAME} - - -U - - ${DB_USER} + - CMD-SHELL + - pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER} timeout: 45s interval: 10s retries: 10 diff --git a/apps/ecommerce-server/package.json b/apps/ecommerce-server/package.json index c479b39..41eb84b 100644 --- a/apps/ecommerce-server/package.json +++ b/apps/ecommerce-server/package.json @@ -1,6 +1,5 @@ { - "name": "@sample-application/server", - "version": "0.1.3", + "name": "@ecommerce/server", "private": true, "scripts": { "start": "nest start", @@ -24,8 +23,6 @@ "@nestjs/config": "1.1.5", "@nestjs/core": "8.4.7", "@nestjs/graphql": "9.1.2", - "@nestjs/jwt": "8.0.0", - "@nestjs/passport": "8.2.2", "@nestjs/platform-express": "8.4.7", "@nestjs/serve-static": "2.2.2", "@nestjs/swagger": "5.1.5", @@ -40,12 +37,17 @@ "nest-morgan": "1.0.1", "nestjs-prisma": "0.19.0", "npm-run-all": "4.1.5", - "passport": "0.6.0", - "passport-http": "0.3.0", - "passport-jwt": "4.0.0", "reflect-metadata": "0.1.13", "swagger-ui-express": "4.3.0", - "ts-node": "9.1.1" + "ts-node": "10.9.1", + "validator": "^13.9.0", + "@nestjs/microservices": "8.2.3", + "kafkajs": "2.2.0", + "@nestjs/jwt": "^10.0.2", + "@nestjs/passport": "^9.0.0", + "passport": "0.6.0", + "passport-http": "0.3.0", + "passport-jwt": "4.0.1" }, "devDependencies": { "@nestjs/cli": "8.2.5", @@ -55,16 +57,17 @@ "@types/graphql-type-json": "0.3.2", "@types/jest": "26.0.19", "@types/normalize-path": "3.0.0", - "@types/passport-http": "0.3.9", - "@types/passport-jwt": "3.0.6", "@types/supertest": "2.0.11", + "@types/validator": "^13.7.15", "jest": "27.0.6", "jest-mock-extended": "^2.0.4", "prisma": "4.6.1", "supertest": "4.0.2", "ts-jest": "27.0.3", "type-fest": "0.11.0", - "typescript": "4.2.3" + "typescript": "4.2.3", + "@types/passport-http": "0.3.9", + "@types/passport-jwt": "3.0.8" }, "jest": { "preset": "ts-jest", diff --git a/apps/ecommerce-server/src/auth/password.service.spec.ts b/apps/ecommerce-server/src/auth/password.service.spec.ts index 79c5a44..309c8c0 100644 --- a/apps/ecommerce-server/src/auth/password.service.spec.ts +++ b/apps/ecommerce-server/src/auth/password.service.spec.ts @@ -1,7 +1,6 @@ import { ConfigService } from "@nestjs/config"; import { Test, TestingModule } from "@nestjs/testing"; import { PasswordService } from "./password.service"; -import * as bcrypt from "bcrypt"; const EXAMPLE_PASSWORD = "examplePassword"; const EXAMPLE_HASHED_PASSWORD = "exampleHashedPassword"; @@ -12,11 +11,16 @@ const configServiceGetMock = jest.fn(() => { return EXAMPLE_SALT_OR_ROUNDS; }); -jest.mock("bcrypt"); +jest.mock("bcrypt", () => ({ + hash: jest.fn(), + compare: jest.fn(), +})); -bcrypt.hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); +const { hash, compare } = jest.requireMock("bcrypt"); -bcrypt.compare.mockImplementation(async () => true); +hash.mockImplementation(async () => EXAMPLE_HASHED_PASSWORD); + +compare.mockImplementation(async () => true); describe("PasswordService", () => { let service: PasswordService; diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index b8a9ce1..c10b264 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("nqy7krj5") + .setVersion("auewd2vm") .addBearerAuth() .build(); diff --git a/apps/ecommerce-server/src/user/base/User.ts b/apps/ecommerce-server/src/user/base/User.ts index 0050859..45adebe 100644 --- a/apps/ecommerce-server/src/user/base/User.ts +++ b/apps/ecommerce-server/src/user/base/User.ts @@ -11,8 +11,9 @@ https://docs.amplication.com/how-to/custom-code */ import { ObjectType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import { IsDate, IsString, IsOptional, IsJSON } from "class-validator"; +import { IsDate, IsString, IsOptional } from "class-validator"; import { Type } from "class-transformer"; +import { IsJSONValue } from "@app/custom-validators"; import { GraphQLJSON } from "graphql-type-json"; import { JsonValue } from "type-fest"; @@ -59,7 +60,7 @@ class User { @ApiProperty({ required: true, }) - @IsJSON() + @IsJSONValue() @Field(() => GraphQLJSON) roles!: JsonValue; diff --git a/apps/ecommerce-server/src/user/base/UserCreateInput.ts b/apps/ecommerce-server/src/user/base/UserCreateInput.ts index adba25b..6896f2a 100644 --- a/apps/ecommerce-server/src/user/base/UserCreateInput.ts +++ b/apps/ecommerce-server/src/user/base/UserCreateInput.ts @@ -11,7 +11,8 @@ https://docs.amplication.com/how-to/custom-code */ import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import { IsString, IsOptional, IsJSON } from "class-validator"; +import { IsString, IsOptional } from "class-validator"; +import { IsJSONValue } from "@app/custom-validators"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; @@ -50,7 +51,7 @@ class UserCreateInput { @ApiProperty({ required: true, }) - @IsJSON() + @IsJSONValue() @Field(() => GraphQLJSON) roles!: InputJsonValue; diff --git a/apps/ecommerce-server/src/user/base/UserUpdateInput.ts b/apps/ecommerce-server/src/user/base/UserUpdateInput.ts index 5e77d9f..b6e0e21 100644 --- a/apps/ecommerce-server/src/user/base/UserUpdateInput.ts +++ b/apps/ecommerce-server/src/user/base/UserUpdateInput.ts @@ -11,7 +11,8 @@ https://docs.amplication.com/how-to/custom-code */ import { InputType, Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import { IsString, IsOptional, IsJSON } from "class-validator"; +import { IsString, IsOptional } from "class-validator"; +import { IsJSONValue } from "@app/custom-validators"; import { GraphQLJSON } from "graphql-type-json"; import { InputJsonValue } from "../../types"; @@ -53,7 +54,7 @@ class UserUpdateInput { @ApiProperty({ required: false, }) - @IsJSON() + @IsJSONValue() @IsOptional() @Field(() => GraphQLJSON, { nullable: true, diff --git a/apps/ecommerce-server/src/validators/index.ts b/apps/ecommerce-server/src/validators/index.ts new file mode 100644 index 0000000..7f62d84 --- /dev/null +++ b/apps/ecommerce-server/src/validators/index.ts @@ -0,0 +1 @@ +export * from "./is-json-value-validator"; diff --git a/apps/ecommerce-server/src/validators/is-json-value-validator.spec.ts b/apps/ecommerce-server/src/validators/is-json-value-validator.spec.ts new file mode 100644 index 0000000..5a77824 --- /dev/null +++ b/apps/ecommerce-server/src/validators/is-json-value-validator.spec.ts @@ -0,0 +1,44 @@ +import { validate, ValidationError } from "class-validator"; +import { IsJSONValue } from "./is-json-value-validator"; + +class TestClass { + @IsJSONValue() + jsonProperty: unknown; +} + +describe("IsJSONValue", () => { + it("should validate a valid JSON string", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = '{"name": "John", "age": 30}'; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(0); + }); + + it("should not validate an invalid JSON string", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = '{name: "John", age: 30}'; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(1); + }); + + it("should not validate an invalid JSON string", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = "John"; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(1); + }); + + it("should validate a valid JSON object", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = { name: "John", age: 30 }; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(0); + }); + + it("should validate a valid JSON array", async () => { + const testObj = new TestClass(); + testObj.jsonProperty = ["John", "30"]; + const errors: ValidationError[] = await validate(testObj); + expect(errors.length).toBe(0); + }); +}); diff --git a/apps/ecommerce-server/src/validators/is-json-value-validator.ts b/apps/ecommerce-server/src/validators/is-json-value-validator.ts new file mode 100644 index 0000000..7b96b4a --- /dev/null +++ b/apps/ecommerce-server/src/validators/is-json-value-validator.ts @@ -0,0 +1,29 @@ +import { + ValidationArguments, + registerDecorator, + ValidationOptions, +} from "class-validator"; +import isJSONValidator from "validator/lib/isJSON"; + +export function IsJSONValue(validationOptions?: ValidationOptions) { + return function (object: Object, propertyName: string) { + registerDecorator({ + name: "IsJSONValue", + target: object.constructor, + propertyName: propertyName, + options: validationOptions, + validator: { + validate(value: any, args: ValidationArguments) { + if (typeof value === "string") { + return isJSONValidator(value); + } + + return isJSONValidator(JSON.stringify(value)); + }, + defaultMessage(args: ValidationArguments): string { + return `${args.property} must be a valid json`; + }, + }, + }); + }; +} diff --git a/apps/ecommerce-server/tsconfig.json b/apps/ecommerce-server/tsconfig.json index ff90c46..f084cf7 100644 --- a/apps/ecommerce-server/tsconfig.json +++ b/apps/ecommerce-server/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": "./", "module": "commonjs", "declaration": false, "removeComments": true, @@ -14,7 +15,10 @@ "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "skipLibCheck": true, - "strict": true + "strict": true, + "paths": { + "@app/custom-validators": ["src/validators"] + } }, "include": ["src"] } From 38adb8a69ffabf227283f151cd93e17a15e704fd Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 07:51:49 +0000 Subject: [PATCH 82/85] Amplication build # clhfz3cbz0v58cg01te9xx1x9. Commit message: https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbozbamx00noj301wjlnxivl/builds/clhfz3cbz0v58cg01te9xx1x9 --- apps/logistic-server/.env | 9 +-- apps/logistic-server/docker-compose.yml | 61 +++++++++++-------- apps/logistic-server/package.json | 3 +- apps/logistic-server/src/app.module.ts | 3 +- .../src/kafka/base/kafka.service.base.ts | 10 --- .../src/kafka/generateKafkaClientOptions.ts | 42 ------------- .../logistic-server/src/kafka/kafka.module.ts | 18 ------ .../src/kafka/kafka.service.ts | 5 -- .../src/nats/base/nats.service.base.ts | 12 ++++ .../src/nats/nats.module.factory.ts | 19 ++++++ apps/logistic-server/src/nats/nats.module.ts | 22 +++++++ apps/logistic-server/src/nats/nats.service.ts | 5 ++ .../src/{kafka => nats}/topics.ts | 0 apps/logistic-server/src/swagger.ts | 2 +- 14 files changed, 102 insertions(+), 109 deletions(-) delete mode 100644 apps/logistic-server/src/kafka/base/kafka.service.base.ts delete mode 100644 apps/logistic-server/src/kafka/generateKafkaClientOptions.ts delete mode 100644 apps/logistic-server/src/kafka/kafka.module.ts delete mode 100644 apps/logistic-server/src/kafka/kafka.service.ts create mode 100644 apps/logistic-server/src/nats/base/nats.service.base.ts create mode 100644 apps/logistic-server/src/nats/nats.module.factory.ts create mode 100644 apps/logistic-server/src/nats/nats.module.ts create mode 100644 apps/logistic-server/src/nats/nats.service.ts rename apps/logistic-server/src/{kafka => nats}/topics.ts (100%) diff --git a/apps/logistic-server/.env b/apps/logistic-server/.env index d45c501..2e936f0 100644 --- a/apps/logistic-server/.env +++ b/apps/logistic-server/.env @@ -1,14 +1,15 @@ BCRYPT_SALT=10 COMPOSE_PROJECT_NAME=amp_clbozbamx00noj301wjlnxivl PORT=3000 +KAFKA_BROKERS=localhost:9092 +KAFKA_ENABLE_SSL=false +KAFKA_CLIENT_ID=logistic +KAFKA_GROUP_ID=logistic +NATS_SERVERS=localhost:4222 DB_USER=root DB_PASSWORD=admin DB_PORT=3306 DB_NAME=my-db DB_URL=mysql://root:admin@localhost:3306/my-db -KAFKA_BROKERS=localhost:9092 -KAFKA_ENABLE_SSL=false -KAFKA_CLIENT_ID=logistic -KAFKA_GROUP_ID=logistic JWT_SECRET_KEY=Change_ME!!! JWT_EXPIRATION=2d \ No newline at end of file diff --git a/apps/logistic-server/docker-compose.yml b/apps/logistic-server/docker-compose.yml index 1a13930..6d970d3 100644 --- a/apps/logistic-server/docker-compose.yml +++ b/apps/logistic-server/docker-compose.yml @@ -27,31 +27,6 @@ services: depends_on: db: condition: service_healthy - adminer: - image: adminer - restart: always - ports: - - 1234:8080 - db: - image: mysql - command: --default-authentication-plugin=mysql_native_password - restart: always - ports: - - ${DB_PORT}:3306 - environment: - MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} - healthcheck: - test: - - CMD - - mysqladmin - - ping - - -h - - localhost - - -u - - ${DB_USER} - timeout: 45s - interval: 10s - retries: 10 zookeeper: image: confluentinc/cp-zookeeper:5.2.4 networks: @@ -79,9 +54,41 @@ services: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 -volumes: - mysql: ~ + nats: + image: nats:2.9.15 + networks: + - internal + ports: + - 4222:4222 + - 8222:8222 + adminer: + image: adminer + restart: always + ports: + - 1234:8080 + db: + image: mysql + command: --default-authentication-plugin=mysql_native_password + restart: always + ports: + - ${DB_PORT}:3306 + environment: + MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} + healthcheck: + test: + - CMD + - mysqladmin + - ping + - -h + - localhost + - -u + - ${DB_USER} + timeout: 45s + interval: 10s + retries: 10 networks: internal: name: internal driver: bridge +volumes: + mysql: ~ diff --git a/apps/logistic-server/package.json b/apps/logistic-server/package.json index 06f32c1..248e693 100644 --- a/apps/logistic-server/package.json +++ b/apps/logistic-server/package.json @@ -41,8 +41,9 @@ "swagger-ui-express": "4.3.0", "ts-node": "10.9.1", "validator": "^13.9.0", - "@nestjs/microservices": "8.2.3", + "@nestjs/microservices": "^9.3.10", "kafkajs": "2.2.0", + "nats": "^2.13.1", "@nestjs/jwt": "^10.0.2", "@nestjs/passport": "^9.0.0", "passport": "0.6.0", diff --git a/apps/logistic-server/src/app.module.ts b/apps/logistic-server/src/app.module.ts index 7735924..57ae385 100644 --- a/apps/logistic-server/src/app.module.ts +++ b/apps/logistic-server/src/app.module.ts @@ -7,7 +7,8 @@ import { ShipmentModule } from "./shipment/shipment.module"; import { HealthModule } from "./health/health.module"; import { PrismaModule } from "./prisma/prisma.module"; import { SecretsManagerModule } from "./providers/secrets/secretsManager.module"; -import { KafkaModule } from "./kafka/kafka.module"; +import { KafkaModule } from "./nats/kafka.module"; +import { NatsModule } from "./nats/nats.module"; import { ConfigModule, ConfigService } from "@nestjs/config"; import { ServeStaticModule } from "@nestjs/serve-static"; import { ServeStaticOptionsService } from "./serveStaticOptions.service"; diff --git a/apps/logistic-server/src/kafka/base/kafka.service.base.ts b/apps/logistic-server/src/kafka/base/kafka.service.base.ts deleted file mode 100644 index 2068531..0000000 --- a/apps/logistic-server/src/kafka/base/kafka.service.base.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Inject } from "@nestjs/common"; -import { ClientKafka } from "@nestjs/microservices"; - -export class KafkaServiceBase { - constructor(@Inject("KAFKA_CLIENT") private kafkaClient: ClientKafka) {} - - async onModuleInit() { - await this.kafkaClient.connect(); - } -} diff --git a/apps/logistic-server/src/kafka/generateKafkaClientOptions.ts b/apps/logistic-server/src/kafka/generateKafkaClientOptions.ts deleted file mode 100644 index 6237997..0000000 --- a/apps/logistic-server/src/kafka/generateKafkaClientOptions.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { KafkaOptions, Transport } from "@nestjs/microservices"; - -export const generateKafkaClientOptions = (): KafkaOptions => { - if (!process.env.KAFKA_BROKERS) { - throw new Error("KAFKA_BROKERS environment variable must be defined"); - } - - if (!process.env.KAFKA_ENABLE_SSL) { - throw new Error("KAFKA_ENABLE_SSL environment variable must be defined"); - } - - if (!process.env.KAFKA_CLIENT_ID) { - throw new Error("KAFKA_CLIENT_ID environment variable must be defined"); - } - - if (!process.env.KAFKA_GROUP_ID) { - throw new Error("KAFKA_GROUP_ID environment variable must be defined"); - } - - const kafkaBrokersString = process.env.KAFKA_BROKERS; - const kafkaEnableSSL = process.env.KAFKA_ENABLE_SSL === "true"; - const kafkaClientId = process.env.KAFKA_CLIENT_ID; - const kafkaGroupId = process.env.KAFKA_GROUP_ID; - - return { - transport: Transport.KAFKA, - options: { - client: { - clientId: kafkaClientId, - brokers: [...kafkaBrokersString.split(",")], - ssl: kafkaEnableSSL, - }, - producer: { - metadataMaxAge: 3000, - }, - consumer: { - rebalanceTimeout: 3000, - groupId: kafkaGroupId, - }, - }, - }; -}; diff --git a/apps/logistic-server/src/kafka/kafka.module.ts b/apps/logistic-server/src/kafka/kafka.module.ts deleted file mode 100644 index 4c80a5e..0000000 --- a/apps/logistic-server/src/kafka/kafka.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Module } from "@nestjs/common"; -import { ClientsModule } from "@nestjs/microservices"; -import { generateKafkaClientOptions } from "./generateKafkaClientOptions"; -import { KafkaService } from "./kafka.service"; - -@Module({ - imports: [ - ClientsModule.register([ - { - name: "KAFKA_CLIENT", - ...generateKafkaClientOptions(), - }, - ]), - ], - providers: [KafkaService], - exports: [KafkaService, ClientsModule], -}) -export class KafkaModule {} diff --git a/apps/logistic-server/src/kafka/kafka.service.ts b/apps/logistic-server/src/kafka/kafka.service.ts deleted file mode 100644 index 821e948..0000000 --- a/apps/logistic-server/src/kafka/kafka.service.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Injectable } from "@nestjs/common"; -import { KafkaServiceBase } from "./base/kafka.service.base"; - -@Injectable() -export class KafkaService extends KafkaServiceBase {} diff --git a/apps/logistic-server/src/nats/base/nats.service.base.ts b/apps/logistic-server/src/nats/base/nats.service.base.ts new file mode 100644 index 0000000..6e633c3 --- /dev/null +++ b/apps/logistic-server/src/nats/base/nats.service.base.ts @@ -0,0 +1,12 @@ +import { Inject } from "@nestjs/common"; +import { ClientNats } from "@nestjs/microservices"; + +export class NatsServiceBase { + constructor( + @Inject("NATS_CLIENT") protected readonly natsClient: ClientNats + ) {} + + async onModuleInit() { + await this.natsClient.connect(); + } +} diff --git a/apps/logistic-server/src/nats/nats.module.factory.ts b/apps/logistic-server/src/nats/nats.module.factory.ts new file mode 100644 index 0000000..a940113 --- /dev/null +++ b/apps/logistic-server/src/nats/nats.module.factory.ts @@ -0,0 +1,19 @@ +import { ConfigService } from "@nestjs/config"; +import { ClientProvider, Transport } from "@nestjs/microservices"; + +export const natsClientModuleFactory = ( + configService: ConfigService +): ClientProvider => { + const natsServersString = configService.get("NATS_SERVERS"); + if (!natsServersString) { + throw new Error("NATS_SERVERS environment variable must be defined"); + } + + return { + transport: Transport.NATS, + options: { + servers: [...natsServersString.split(",")], + name: "logistic", + }, + }; +}; diff --git a/apps/logistic-server/src/nats/nats.module.ts b/apps/logistic-server/src/nats/nats.module.ts new file mode 100644 index 0000000..2bd890c --- /dev/null +++ b/apps/logistic-server/src/nats/nats.module.ts @@ -0,0 +1,22 @@ +import { Module } from "@nestjs/common"; +import { ConfigService } from "@nestjs/config"; +import { ClientsModule } from "@nestjs/microservices"; +import { NatsController } from "./nats.controller"; +import { natsClientModuleFactory } from "./nats.module.factory"; +import { NatsService } from "./nats.service"; + +@Module({ + imports: [ + ClientsModule.registerAsync([ + { + name: "NATS_CLIENT", + inject: [ConfigService], + useFactory: natsClientModuleFactory, + }, + ]), + ], + controllers: [NatsController], + providers: [NatsService], + exports: [NatsService, ClientsModule], +}) +export class NatsModule {} diff --git a/apps/logistic-server/src/nats/nats.service.ts b/apps/logistic-server/src/nats/nats.service.ts new file mode 100644 index 0000000..ce2e0da --- /dev/null +++ b/apps/logistic-server/src/nats/nats.service.ts @@ -0,0 +1,5 @@ +import { Injectable } from "@nestjs/common"; +import { NatsServiceBase } from "./base/nats.service.base"; + +@Injectable() +export class NatsService extends NatsServiceBase {} diff --git a/apps/logistic-server/src/kafka/topics.ts b/apps/logistic-server/src/nats/topics.ts similarity index 100% rename from apps/logistic-server/src/kafka/topics.ts rename to apps/logistic-server/src/nats/topics.ts diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index f2949ee..33eddbb 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("auewd2vm") + .setVersion("77v7vc5m") .addBearerAuth() .build(); From a49d0d90ea13d01feea94856b6db3530b13b9471 Mon Sep 17 00:00:00 2001 From: "amplication[bot]" <100755160+amplication[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 07:52:01 +0000 Subject: [PATCH 83/85] Amplication build # clhfz3cc10v6kcg01xzned55i. Commit message: https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbox9qt800t6nm017tzaup5o/builds/clhfz3cc10v6kcg01xzned55i --- apps/ecommerce-server/src/swagger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ecommerce-server/src/swagger.ts b/apps/ecommerce-server/src/swagger.ts index c10b264..a441316 100644 --- a/apps/ecommerce-server/src/swagger.ts +++ b/apps/ecommerce-server/src/swagger.ts @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("auewd2vm") + .setVersion("77v7vc5m") .addBearerAuth() .build(); From e2dbe9e967de9e665f2acff28e18ababd4c1840a Mon Sep 17 00:00:00 2001 From: "amplication[bot]" Date: Thu, 25 May 2023 07:50:03 +0000 Subject: [PATCH 84/85] Amplication build # cli2u2m0l034qhx0123ihzbfl Build URL: [https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbozbamx00noj301wjlnxivl/builds/cli2u2m0l034qhx0123ihzbfl](https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbozbamx00noj301wjlnxivl/builds/cli2u2m0l034qhx0123ihzbfl) --- apps/logistic-server/README.md | 113 +++++++----------- apps/logistic-server/package.json | 3 +- apps/logistic-server/src/swagger.ts | 1 - .../src/tests/health/health.service.spec.ts | 2 +- 4 files changed, 48 insertions(+), 71 deletions(-) diff --git a/apps/logistic-server/README.md b/apps/logistic-server/README.md index a43c337..9de25c0 100644 --- a/apps/logistic-server/README.md +++ b/apps/logistic-server/README.md @@ -1,87 +1,66 @@ -# Getting started with your app +

+ + amplication-logo + +

-## Available Scripts +# Introduction -In the `server` subdirectory, you can run: +This service was generated with Amplication. The server-side of the generated project. This component provides the different backend services - i.e., REST API, GraphQL API, authentication, authorization, logging, data validation and the connection to the database. Additional information about the server component and the architecture around it, can be found on the [documentation](https://docs.amplication.com/guides/getting-started) site. -### `npm start` +# Getting started -Runs the app in development mode. -By default, it is accessible at http://localhost:3000 +## Step 1: Configuration -### `npm test` +Configuration for the server component can be provided through the use of environment variables. These can be passed to the application via the use of the `.env` file in the base directory of the generated service. Below a table can be found which show the different variables that can be passed - these are the variables which exist by default, through the use of plugins additional integrations could require additional values. These values are provided default values after generation, change them to the desired values. -Runs tests. +| Variable | Description | Value | +| -------------------- | -------------------------------------------- | ------------------------------------------------------------------- | +| BCRYPT_SALT | the string used for hashing | [random-string] | +| COMPOSE_PROJECT_NAME | the identifier of the service plus prefix | amp_[service-identifier] | +| PORT | the port on which to run the server | 3000 | +| DB_URL | the connection url for the database | [db-provider]://[username]:[password]@localhost:[db-port]/[db-name] | +| DB_PORT | the port used by the database instance | [db-provider-port] | +| DB_USER | the username used to connect to the database | [username] | +| DB_PASSWORD | the password used to connect to the database | [password] | +| DB_NAME | the name of the database | [service-name] / [project-name] | +| JWT_SECRET_KEY | the secret used to sign the json-web token | [secret] | +| JWT_EXPIRATION | the expiration time for the json-web token | 2d | -### `npm run build` +> **Note** +> Amplication generates default values and stores them under the .env file. It is advised to use some form of secrets manager/vault solution when using in production. -Builds the app for production in the `dist` folder. +## Step 2.1: Scripts - pre-requisites -Your app is ready to be deployed! +After configuration of the server the next step would be to run the application. Before running the server side of the component, make sure that the different pre-requisites are met - i.e., node.js [^16.x], npm, docker. After the setup of the pre-requisites the server component can be started. -## Environment Variables: - -| Environment | Description | Value | -| -------------------- | ---------------------------------------- | ---------------------------------------------------------- | -| DEBUG_MODE | Debug level | 1 | -| DB_URL | Local database connection URL | db-provider://admin:admin@localhost:${DB_PORT}/\${DB_NAME} | -| DB_PORT | Local database port | | -| DB_USER | Local database username | admin | -| DB_PASSWORD | Local database password | admin | -| COMPOSE_PROJECT_NAME | Docker Compose project name | amp\_{applicationId} | -| SERVER_PORT | The port that the server is listening to | 3000 | -| JWT_SECRET_KEY | JWT secret | Change_ME!!! | -| JWT_EXPIRATION | JWT expiration in days | 2d | - -\*db-provider - the prisma DB provider (for example: for postgres is postgresql and for MySQL is mysql) - -## Getting Started - Local Development - -### Prerequisites - -Make sure you have Node.js 16.x, npm, and Docker installed. - -### Install dependencies - -In the `server` subdirectory, run: - -```console -cd server -npm install +```sh +# installation of the dependencies +$ npm install ``` - -### Generate Prisma client - -```console -npm run prisma:generate +```sh +# generate the prisma client +$ npm run prisma:generate ``` - -### Start database using Docker - -```console -npm run docker:db +```sh +# start the database where the server component will connect to +$ npm run docker:db ``` - -### Initialize the database - -```console -npm run db:init +```sh +# initialize the database +$ npm run db:init ``` -### Start the server +## Step 2.2: Scripts - local development -```console -npm start +```shell +# start the server component +$ npm run install ``` -## Getting Started - Docker Compose - -In the `server` subdirectory, run: +## Step 2.2: Scripts - container based development -```console -npm run compose:up +```shell +# start the server component as a docker container +$ npm run compose:up ``` - -## Learn more - -You can learn more in the [Amplication documentation](https://docs.amplication.com/guides/getting-started). diff --git a/apps/logistic-server/package.json b/apps/logistic-server/package.json index 248e693..ff465ac 100644 --- a/apps/logistic-server/package.json +++ b/apps/logistic-server/package.json @@ -14,7 +14,7 @@ "db:init": "run-s \"db:migrate-save -- --name 'initial version'\" db:migrate-up seed", "prisma:generate": "prisma generate", "docker:db": "docker-compose -f docker-compose.db.yml up -d", - "docker:build": "docker build .", + "package:container": "docker build .", "compose:up": "docker-compose up -d", "compose:down": "docker-compose down --volumes" }, @@ -35,7 +35,6 @@ "graphql-type-json": "0.3.2", "nest-access-control": "2.0.3", "nest-morgan": "1.0.1", - "nestjs-prisma": "0.19.0", "npm-run-all": "4.1.5", "reflect-metadata": "0.1.13", "swagger-ui-express": "4.3.0", diff --git a/apps/logistic-server/src/swagger.ts b/apps/logistic-server/src/swagger.ts index 33eddbb..6270b3e 100644 --- a/apps/logistic-server/src/swagger.ts +++ b/apps/logistic-server/src/swagger.ts @@ -7,7 +7,6 @@ export const swaggerDocumentOptions = new DocumentBuilder() .setDescription( '\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' ) - .setVersion("77v7vc5m") .addBearerAuth() .build(); diff --git a/apps/logistic-server/src/tests/health/health.service.spec.ts b/apps/logistic-server/src/tests/health/health.service.spec.ts index f7cd00b..270b5a2 100644 --- a/apps/logistic-server/src/tests/health/health.service.spec.ts +++ b/apps/logistic-server/src/tests/health/health.service.spec.ts @@ -1,5 +1,5 @@ import { mock } from "jest-mock-extended"; -import { PrismaService } from "nestjs-prisma"; +import { PrismaService } from "../../prisma/prisma.service"; import { HealthServiceBase } from "../../health/base/health.service.base"; describe("Testing the HealthServiceBase", () => { From 191054f4df61b8030a0b27044080a299efbf667a Mon Sep 17 00:00:00 2001 From: "amplication[bot]" Date: Thu, 25 May 2023 07:50:27 +0000 Subject: [PATCH 85/85] Amplication build # cli2u2m0m0361hx01c2jj2v8i Build URL: [https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbox9qt800t6nm017tzaup5o/builds/cli2u2m0m0361hx01c2jj2v8i](https://app.amplication.com/ckyrgxlfa135491801s6vj2ygjn4/clbox7jiw00n8j301opsinsbx/clbox9qt800t6nm017tzaup5o/builds/cli2u2m0m0361hx01c2jj2v8i) --- apps/ecommerce-admin/README.md | 68 ++++++----- apps/ecommerce-admin/package.json | 2 +- apps/ecommerce-admin/src/Login.tsx | 6 +- apps/ecommerce-server/README.md | 113 +++++++----------- apps/ecommerce-server/package.json | 3 +- .../src/address/base/address.resolver.base.ts | 4 +- .../customer/base/customer.resolver.base.ts | 13 +- .../src/order/base/order.resolver.base.ts | 18 ++- .../src/product/base/product.resolver.base.ts | 4 +- apps/ecommerce-server/src/swagger.ts | 1 - .../src/tests/health/health.service.spec.ts | 2 +- 11 files changed, 116 insertions(+), 118 deletions(-) diff --git a/apps/ecommerce-admin/README.md b/apps/ecommerce-admin/README.md index a7da2ed..f791dc3 100644 --- a/apps/ecommerce-admin/README.md +++ b/apps/ecommerce-admin/README.md @@ -1,47 +1,53 @@ -# Amplication +

+ + amplication-logo + +

-This app was generated with Amplication. -You can learn more in the [Amplication documentation](https://docs.amplication.com/guides/getting-started). +# Introduction -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), and built with [react-admin](https://marmelab.com/react-admin/) +This service was generated with Amplication. It serves as the client-side for the generated server component. The client-side consist of a React application with ready-made forms for creating and editing the different data models of the application. It is pre-conffigured to work with the server and comes with the boilerplate and foundation for the client - i.e., routing, navigation, authentication, premissions, menu, breadcrumbs, error handling and much more. Additional information about the admin component and the architecture around it, can be found on the [documentation](https://docs.amplication.com/guides/getting-started) site. This side of the generated project was bootstrapped with [create-react-app](https://github.com/facebook/create-react-app) and built with [react-admin](https://marmelab.com/react-admin/). -## Environment Variables -| Environment | Description | Value | -| -------------------- | ------------------------------------------- | --------------------- | -| PORT | The port that the client UI is listening to | -| REACT_APP_SERVER_URL | Amplication Server URL | http://localhost:3000 | +

+ +

-## Available Scripts +# Getting started -In the `admin-ui` subdirectory, you can run: +## Step 1: Configuration -### `yarn start` +Configuration for the client component can be provided through the use of environment variables. These can be passed to the application via the use of the `.env` file in the base directory of the generated service. Below a table can be found which show the different variables that can be passed. These values are provided default values after generation, change them to the desired values. -Runs the app in development mode. +| Variable | Description | Value | +| -------------------- | ------------------------------------------------ | ------------------------------ | +| PORT | the port on which to run the client | 3001 | +| REACT_APP_SERVER_URL | the url on which the server component is running | http://localhost:[server-port] | -Open [http://localhost:3001](http://localhost:3001) to view it in the browser. +> **Note** +> Amplication generates default values and stores them under the .env file. It is advised to use some form of secrets manager/vault solution when using in production. -### `yarn test` -Runs tests to make sure everything is working correctly. +## Step 2: Scripts -### `yarn build` +After configuration of the client the next step would be to run the application. Before running the client side of the component, make sure that the different pre-requisites are met - i.e., npm, docker. Make sure that the server-side of the application is running. -Builds the app for production in the `build` folder. +```sh +# installation of the dependencies +$ npm install +``` -### `yarn eject` +```sh +# starts the application in development mode - available by default under http://localhost:3001 +$ npm run start +``` -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** +```sh +# builds the application in production mode - available under 'build' +$ npm run build +``` -Ejects the Create React App. [Click here for more info](https://create-react-app.dev/docs/available-scripts/#npm-run-eject). - -### `docker:build` - -Build the Admin-UI Docker image. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). +```sh +# removes the single build dependency from the project +$ npm run eject +``` \ No newline at end of file diff --git a/apps/ecommerce-admin/package.json b/apps/ecommerce-admin/package.json index 909a162..d88d9a7 100644 --- a/apps/ecommerce-admin/package.json +++ b/apps/ecommerce-admin/package.json @@ -25,7 +25,7 @@ "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "docker:build": "docker build ." + "package:container": "docker build ." }, "eslintConfig": { "extends": [ diff --git a/apps/ecommerce-admin/src/Login.tsx b/apps/ecommerce-admin/src/Login.tsx index 4399ebf..f7ec8ed 100644 --- a/apps/ecommerce-admin/src/Login.tsx +++ b/apps/ecommerce-admin/src/Login.tsx @@ -17,7 +17,7 @@ const Login = ({ theme }: any) => { const submit = (e: any) => { e.preventDefault(); login({ username, password }).catch(() => - notify("Invalid email or password") + notify("Invalid username or password") ); }; @@ -52,7 +52,7 @@ const Login = ({ theme }: any) => {

Admin UI

Sign in to a React-Admin client with ready-made forms for creating - and editing all the data models of your application. + and editing all the data models of your application