diff --git a/package.json b/package.json index 8f53d2f..9d5887d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "movie:test": "pnpm --filter movie-service run test", "test": "npx nx run-many --target=test --all", "build": "npx nx run-many --target=build --all", - "lint": "npx nx run-many --target=lint --all" + "lint": "npx nx run-many -t lint:fix -p auth-service movie-service ticket-service, payment-service" }, "devDependencies": { "nx": "^16.7.4" diff --git a/packages/shared-libs/.eslintrc.js b/packages/shared-libs/.eslintrc.js index 40fbf2f..3484660 100644 --- a/packages/shared-libs/.eslintrc.js +++ b/packages/shared-libs/.eslintrc.js @@ -14,6 +14,5 @@ module.exports = { indent: ['error', 2], semi: ['error', 'always'], 'linebreak-style': ['error', 'unix'], - // quotes: ['error', 'double'], }, }; diff --git a/packages/shared-libs/__tests__/endpoint.logger.spec.ts b/packages/shared-libs/__tests__/endpoint.logger.spec.ts index 91aabee..c0e2bd1 100644 --- a/packages/shared-libs/__tests__/endpoint.logger.spec.ts +++ b/packages/shared-libs/__tests__/endpoint.logger.spec.ts @@ -1,4 +1,4 @@ -import express, { Application } from 'express'; +import express, { Express } from 'express'; import { describe, expect, vi, it } from 'vitest'; import { logger } from '../src/index'; import { @@ -6,12 +6,11 @@ import { concatMethods, longestLength, getlongestPath, - EndpointAttributes, printEndpoints, } from '../src/print.endpoints'; describe('EndpointLogger', () => { - const app: Application = express(); + const app: Express = express(); app.get('/test', (req, res) => { res.send('test'); @@ -47,14 +46,14 @@ describe('EndpointLogger', () => { describe('#concatMethods', () => { it('should return a 2d array of methods', () => { - const methods = concatMethods(endpoints as EndpointAttributes[]); + const methods = concatMethods(endpoints); expect(methods).toStrictEqual([['GET', 'POST'], ['POST']]); }); }); describe('#longestLength', () => { it('should return the longest length of methods', () => { - const methods = concatMethods(endpoints as EndpointAttributes[]); + const methods = concatMethods(endpoints); const [longestmethodString, itemNumber] = longestLength(methods); expect(longestmethodString).toEqual(7); expect(itemNumber).toEqual(2); diff --git a/packages/shared-libs/package.json b/packages/shared-libs/package.json index d10cdf6..314a7b6 100644 --- a/packages/shared-libs/package.json +++ b/packages/shared-libs/package.json @@ -22,7 +22,6 @@ "test": "npm run docker-rabbitmq && vitest --watch", "ui:test": "vitest --ui", "lint": "npm run prettier:check && npm run eslint", - "lint:fix": "npm run eslint:fix && npm run prettier:fix", "prettier:cli": "prettier \"**/*.ts\" \"**/*.js\"", "prettier:check": "npm run prettier:cli -- -l", "prettier:fix": "npm run prettier:cli -- --write", diff --git a/packages/shared-libs/src/authentication.ts b/packages/shared-libs/src/authentication.ts index d1b2ac0..c454b9a 100644 --- a/packages/shared-libs/src/authentication.ts +++ b/packages/shared-libs/src/authentication.ts @@ -1,11 +1,7 @@ import { sign, verify } from 'jsonwebtoken'; -interface ITokenPayload { - customerId: string; -} - -export const generateToken = (payload: ITokenPayload, secretKey: string) => { - return sign(payload, secretKey, { expiresIn: '1d' }); +export const generateToken = (payload: unknown, secretKey: string) => { + return sign({ payload }, secretKey, { expiresIn: '1d' }); }; export const verifyToken = (token: string, secretKey: string) => {