feat: medium tests for user and sync service (#16304)

Co-authored-by: Zack Pollard <zackpollard@ymail.com>
This commit is contained in:
Jason Rasmussen
2025-02-25 11:31:07 -05:00
committed by GitHub
parent ae61ea7984
commit 7c851893b4
15 changed files with 634 additions and 24 deletions

View File

@@ -140,7 +140,7 @@ export class UserService extends BaseService {
if (!license) {
throw new NotFoundException();
}
return license.value;
return { ...license.value, activatedAt: new Date(license.value.activatedAt) };
}
async deleteLicense({ user }: AuthDto): Promise<void> {
@@ -170,17 +170,14 @@ export class UserService extends BaseService {
throw new BadRequestException('Invalid license key');
}
const licenseData = {
...license,
activatedAt: new Date(),
};
const activatedAt = new Date();
await this.userRepository.upsertMetadata(auth.user.id, {
key: UserMetadataKey.LICENSE,
value: licenseData,
value: { ...license, activatedAt: activatedAt.toISOString() },
});
return licenseData;
return { ...license, activatedAt };
}
@OnJob({ name: JobName.USER_SYNC_USAGE, queue: QueueName.BACKGROUND_TASK })