Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawk.api",
"version": "1.1.6",
"version": "1.1.7",
"main": "index.ts",
"license": "UNLICENSED",
"scripts": {
Expand Down
16 changes: 15 additions & 1 deletion src/models/eventsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,21 @@ class EventsFactory extends Factory {
filters = {}
) {
limit = this.validateLimit(limit);
sort = sort === 'BY_COUNT' ? 'count' : 'lastRepetitionTime';

switch (sort) {
case 'BY_COUNT':
sort = 'count';
break;
case 'BY_DATE':
sort = 'lastRepetitionTime';
break;
case 'BY_AFFECTED_USERS':
sort = 'affectedUsers';
break;
default:
sort = 'lastRepetitionTime';
break;
}

const pipeline = [
{
Expand Down
5 changes: 5 additions & 0 deletions src/typeDefs/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ type DailyEventInfo {
Last event occurrence timestamp
"""
lastRepetitionTime: Float!

"""
How many users catch this error per day
"""
affectedUsers: Int
}

type Subscription {
Expand Down
1 change: 1 addition & 0 deletions src/typeDefs/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Possible events order
enum EventsSortOrder {
BY_DATE
BY_COUNT
BY_AFFECTED_USERS
}

"""
Expand Down
Loading