Skip to content

Commit

Permalink
more campaign info added in campaign-news service
Browse files Browse the repository at this point in the history
  • Loading branch information
RalitsaIlieva committed Feb 12, 2024
1 parent 4ff31dc commit b65c7cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
24 changes: 23 additions & 1 deletion apps/api/src/campaign-news/campaign-news.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,14 @@ export class CampaignNewsService {
newsFiles: true,
campaign: {
select: {
id: true,
title: true,
state: true,
campaignType: {
select: {
category: true,
},
},
},
},
},
Expand Down Expand Up @@ -234,7 +240,23 @@ export class CampaignNewsService {

async findArticleBySlug(slug: string) {
return await this.prisma.campaignNews
.findFirst({ where: { slug: slug }, include: { newsFiles: true } })
.findFirst({
where: { slug: slug },
include: {
newsFiles: true,
campaign: {
select: {
title: true,
state: true,
campaignType: {
select: {
category: true,
},
},
},
},
},
})
.catch((error) => Logger.warn(error))
}

Expand Down
10 changes: 3 additions & 7 deletions apps/api/src/campaign/campaign.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,9 @@ export class CampaignController {
}

@Get('byId/:id')
@Roles({
roles: [RealmViewSupporters.role, ViewSupporters.role],
mode: RoleMatchingMode.ANY,
})
@Public()
async findOne(@Param('id') id: string) {
return this.campaignService.getCampaignById(id)
return await this.campaignService.getCampaignById(id)
}

@Get('donations/:id')
Expand Down Expand Up @@ -176,10 +173,9 @@ export class CampaignController {
) {
if (data.consent === false)
throw new BadRequestException('Notification consent should be provided')

// Subscribe to campaign notifications list
await this.campaignService.subscribeToCampaignNotification(id, data)

return { message: 'Success' }
}

Expand Down

0 comments on commit b65c7cd

Please sign in to comment.