Skip to content

Commit

Permalink
Merge pull request #89 from AplinkosMinisterija/count-endpoint-enabled
Browse files Browse the repository at this point in the history
Count endpoint enabled
  • Loading branch information
ambrazasp authored May 17, 2024
2 parents fee28d0 + 141bc89 commit ec8096c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 4 additions & 3 deletions services/events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,18 @@ export function applyEventsQueryBySubscriptions(query: QueryObject, subscription
get: {
auth: EndpointType.PUBLIC,
},
find: {
rest: null,
},
count: {
auth: EndpointType.PUBLIC,
},
find: {
rest: null,
},
},
hooks: {
before: {
list: ['applyFilters'],
find: ['applyFilters'],
count: ['applyFilters'],
get: ['applyFilters'],
resolve: ['applyFilters'],
},
Expand Down
12 changes: 11 additions & 1 deletion services/newsfeed.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const sender = 'esu@smalsuolis.lt';
before: {
list: ['applyFilters'],
find: ['applyFilters'],
count: ['applyFilters'],
get: ['applyFilters'],
resolve: ['applyFilters'],
},
Expand Down Expand Up @@ -66,7 +67,9 @@ export default class NewsfeedService extends moleculer.Service {
return ctx.call('events.find', ctx.params);
}

@Action()
@Action({
rest: 'GET /:id',
})
async get(ctx: Context<any, UserAuthMeta>) {
return ctx.call('events.get', ctx.params);
}
Expand All @@ -76,6 +79,13 @@ export default class NewsfeedService extends moleculer.Service {
return ctx.call('events.resolve', ctx.params);
}

@Action({
rest: 'GET /count',
})
async count(ctx: Context<any, UserAuthMeta>) {
return ctx.call('events.count', ctx.params);
}

@Action()
async handleEmails(ctx: Context<{ frequency: Frequency }>) {
if (!emailCanBeSent()) return;
Expand Down

0 comments on commit ec8096c

Please sign in to comment.