Skip to content

Commit

Permalink
added colorable prop in categories
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Nov 5, 2024
1 parent c3cf4ff commit 1d8b463
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ model Category {
id Int @id @default(autoincrement())
name String @default("")
icon String @default("")
colorable Boolean @default(false)
bandages Bandage[] @relation("Categories")
reachable Boolean @default(true)
only_admins Boolean @default(false)
Expand Down
2 changes: 1 addition & 1 deletion src/common/bandage_response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const generate_response = (data: BandageFull[], session: Session | null,

const result = data.map(el => {
if (el.User?.UserSettings?.banned && !suppress_ban) return undefined;
const categories = el.categories.map(cat => ({ id: cat.id, name: cat.name, icon: cat.icon }))
const categories = el.categories.map(cat => ({ id: cat.id, name: cat.name, icon: cat.icon, colorable: cat.colorable }))
return {
id: el.id,
external_id: el.externalId,
Expand Down
7 changes: 4 additions & 3 deletions src/workshop/bandage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { generate_response } from 'src/common/bandage_response';
const moderation_id = [4, 13]; // на проверке, отклонено
const official_id = 0;


interface BandageSearch {
title?: { contains: string },
description?: { contains: string },
Expand Down Expand Up @@ -226,7 +225,8 @@ export class BandageService {
id: category.id,
name: category.name,
icon: category.icon,
count: category.bandages.length
count: category.bandages.length,
colorable: category.colorable
}));
}

Expand Down Expand Up @@ -308,7 +308,8 @@ export class BandageService {
return {
id: cat.id,
name: cat.name,
icon: cat.icon
icon: cat.icon,
colorable: cat.colorable
}
});

Expand Down

0 comments on commit 1d8b463

Please sign in to comment.