Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/auth/jwt/jwt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export class customJwtService {
constructor(private readonly jwtService: JwtService) {}

sign(payload: Payload): string {
return this.jwtService.sign(payload);
return this.jwtService.sign(payload, {
expiresIn: payload.period,
});
}

verify(token: string, options?: JwtVerifyOptions): Payload {
Expand Down
15 changes: 3 additions & 12 deletions src/categories/category.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,9 @@ export class CategoryService {
queryRunnerManager: EntityManager,
): Promise<DeleteCategoryOutput> {
try {
const userInDb =
await this.userRepository.findOneWithContentsAndCategories(user.id);

// Check if user exists
if (!userInDb) {
throw new NotFoundException('User not found.');
}

const category = userInDb.categories?.find(
(category) => category.id === categoryId,
);

const category = await this.categoryRepository.findOne({
where: { id: categoryId },
});
if (!category) {
throw new NotFoundException('Category not found.');
}
Expand Down