Skip to content

Commit

Permalink
chore: nx format:write update dirty files
Browse files Browse the repository at this point in the history
  • Loading branch information
andes-it committed Jan 21, 2025
1 parent 54fc13a commit 240e522
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ describe('LicenseService', () => {
licenseService = moduleRef.get<LicenseService>(LicenseService)
barcodeService = moduleRef.get<BarcodeService>(BarcodeService)
config = moduleRef.get(LicenseConfig.KEY)

})

describe.each(licenseIds)('given %s license type id', (licenseId) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,11 @@ export class LicenseService {
return `${licenseType}-${sub}`
}

async checkBarcodeSession(barcodeSessionKey: string | undefined, user: User, licenseType: LicenseType) {
async checkBarcodeSession(
barcodeSessionKey: string | undefined,
user: User,
licenseType: LicenseType,
) {
if (barcodeSessionKey) {
const activeBarcodeSession = await this.barcodeService.getSessionCache(
barcodeSessionKey,
Expand Down
9 changes: 7 additions & 2 deletions libs/services/license/src/lib/barcode.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export class BarcodeService {
expiresIn: number
}> {
// jsonwebtoken uses seconds for expiration time
const exp = Math.floor(Date.now() / 1000) + this.config.barcodeExpireTimeInSec
const exp =
Math.floor(Date.now() / 1000) + this.config.barcodeExpireTimeInSec

return new Promise((resolve, reject) =>
sign(
Expand Down Expand Up @@ -94,7 +95,11 @@ export class BarcodeService {
key: string,
value: BarcodeData<Type>,
) {
return this.cacheManager.set(key, value, this.config.barcodeExpireTimeInSec * 1000)
return this.cacheManager.set(
key,
value,
this.config.barcodeExpireTimeInSec * 1000,
)
}

async setSessionCache(key: string, value: string) {
Expand Down
5 changes: 4 additions & 1 deletion libs/services/license/src/lib/license.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const LicenseConfig = defineConfig({
load: (env) => ({
barcodeSecretKey: env.required('LICENSE_SERVICE_BARCODE_SECRET_KEY', ''),
barcodeExpireTimeInSec: env.requiredJSON('BARCODE_EXPIRE_TIME_IN_SEC', 60),
barcodeSessionExpireTimeInSec: env.requiredJSON('BARCODE_SESSION_EXPIRE_TIME_IN_SEC', 1800),
barcodeSessionExpireTimeInSec: env.requiredJSON(
'BARCODE_SESSION_EXPIRE_TIME_IN_SEC',
1800,
),
redis: {
nodes: env.requiredJSON('LICENSE_SERVICE_REDIS_NODES', [
'localhost:7000',
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/problem/src/Problem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
BadSubjectProblem,
TemplateApiErrorProblem,
AttemptFailedProblem,
BadSessionProblem
BadSessionProblem,
} from './problems'

export type Problem =
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/problem/src/problems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface BadSubjectProblem extends BaseProblem {
alternativeSubjects?: AlternativeSubject[]
}
export interface BadSessionProblem extends BaseProblem {
type: ProblemType.BAD_SESSION,
type: ProblemType.BAD_SESSION
}

export interface AttemptFailedProblem extends BaseProblem {
Expand Down

0 comments on commit 240e522

Please sign in to comment.