From 42a3f2bed8fa27102ec3cdaff6ea8ae59876359b Mon Sep 17 00:00:00 2001 From: Mor Hagbi Date: Thu, 30 Nov 2023 15:02:57 +0200 Subject: [PATCH 1/2] add auth entity service findOne function dynamic name --- plugins/auth-core/package-lock.json | 4 ++-- plugins/auth-core/package.json | 2 +- plugins/auth-core/src/core/create-auth-service.ts | 2 ++ plugins/auth-core/src/templates/auth.service.template.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/auth-core/package-lock.json b/plugins/auth-core/package-lock.json index 7c68a8dd..2540ae3f 100644 --- a/plugins/auth-core/package-lock.json +++ b/plugins/auth-core/package-lock.json @@ -1,12 +1,12 @@ { "name": "@amplication/plugin-auth-core", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@amplication/plugin-auth-core", - "version": "2.0.4", + "version": "2.0.5", "license": "Apache-2.0", "dependencies": { "@amplication/code-gen-types": "^2.0.17", diff --git a/plugins/auth-core/package.json b/plugins/auth-core/package.json index 07860969..f053d070 100644 --- a/plugins/auth-core/package.json +++ b/plugins/auth-core/package.json @@ -1,6 +1,6 @@ { "name": "@amplication/plugin-auth-core", - "version": "2.0.4", + "version": "2.0.5", "description": "set auth for Amplication build", "main": "dist/index.js", "nx": {}, diff --git a/plugins/auth-core/src/core/create-auth-service.ts b/plugins/auth-core/src/core/create-auth-service.ts index 9c9899cc..ccd9246b 100644 --- a/plugins/auth-core/src/core/create-auth-service.ts +++ b/plugins/auth-core/src/core/create-auth-service.ts @@ -16,6 +16,7 @@ import { import { builders, namedTypes } from "ast-types"; import { print } from "@amplication/code-gen-utils"; import { addInjectableDependency } from "../util/nestjs-code-generation"; +import { camelCase } from "lodash"; const authServicePath = join(templatesPath, "auth.service.template.ts"); @@ -74,6 +75,7 @@ async function mapAuthServiceTemplate( ENTITY_NAME_INFO: builders.identifier(`${authEntity.name}Info`), ENTITY_SERVICE: builders.identifier(`${entityNameToLower}Service`), ENTITY_SERVICE_UPPER: builders.identifier(`${authEntity?.name}Service`), + FIND_ONE_FUNCTION: builders.identifier(`${camelCase(authEntity?.name) }`) }; const filePath = `${serverDirectories.authDirectory}/${fileName}`; diff --git a/plugins/auth-core/src/templates/auth.service.template.ts b/plugins/auth-core/src/templates/auth.service.template.ts index 22fe07a8..1061d492 100644 --- a/plugins/auth-core/src/templates/auth.service.template.ts +++ b/plugins/auth-core/src/templates/auth.service.template.ts @@ -19,7 +19,7 @@ export class AuthService { username: string, password: string ): Promise { - const user = await this.ENTITY_SERVICE.findOne({ + const user = await this.ENTITY_SERVICE.FIND_ONE_FUNCTION({ where: { username }, }); if (user && (await this.passwordService.compare(password, user.password))) { From c85042837ca689d121eda6833637b4ad67bf2e88 Mon Sep 17 00:00:00 2001 From: Mor Hagbi Date: Tue, 5 Dec 2023 13:44:11 +0200 Subject: [PATCH 2/2] feat(auth-core): add changelog file --- plugins/auth-core/CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 plugins/auth-core/CHANGELOG.md diff --git a/plugins/auth-core/CHANGELOG.md b/plugins/auth-core/CHANGELOG.md new file mode 100644 index 00000000..3328a555 --- /dev/null +++ b/plugins/auth-core/CHANGELOG.md @@ -0,0 +1,16 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [2.0.5] + +This version: + +- adds support for new DSG v3.0.0. + +### Changes + +
  • 42a3f2b • feat(auth-core):update auth-service template with a dynamic authEntity findOne function name