Skip to content
Open
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
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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint is for administrators only, and the returned data by it is not meant to be public.
If the goal is to get the donation data of campaign, please use one of the available Public() endpoints

@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