-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a9ca29
commit fa7cf27
Showing
2 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
'use strict' | ||
|
||
const { gql } = require('apollo-server-micro') | ||
|
||
module.exports = gql` | ||
""" | ||
Event entries will be stored as actions. The TotalSumAction contains data for a TotalSum type event. | ||
""" | ||
type TotalSumAction { | ||
""" | ||
Action identifier. | ||
""" | ||
id: ID! | ||
""" | ||
Identifies the date and time when the object was created. | ||
""" | ||
created: DateTime! | ||
""" | ||
Identifies the date and time when the object was updated. | ||
""" | ||
updated: DateTime! | ||
} | ||
input CreateTotalSumActionInput { | ||
""" | ||
Numerical value that is added to all other numerical values of the same day, month or year. | ||
""" | ||
value: Float! | ||
} | ||
type CreateTotalSumActionPayload { | ||
""" | ||
Indicates that the action creation was successful. Might be 'null' otherwise. | ||
""" | ||
success: Boolean | ||
""" | ||
The newly created action. | ||
""" | ||
payload: TotalSumAction | ||
} | ||
input UpdateTotalSumActionInput { | ||
""" | ||
Numerical value that is added to all other numerical values of the same day, month or year. | ||
""" | ||
value: Float! | ||
} | ||
type UpdateTotalSumActionPayload { | ||
""" | ||
Indicates that the action update was successful. Might be 'null' otherwise. | ||
""" | ||
success: Boolean | ||
""" | ||
The updated action. | ||
""" | ||
payload: TotalSumAction | ||
} | ||
type Mutation { | ||
""" | ||
Create a new action for a TotalSum type event. | ||
""" | ||
createTotalSumAction(eventId: ID!, input: CreateTotalSumActionInput!): CreateTotalSumActionPayload! | ||
""" | ||
Update an existing action for a TotalSum type event. | ||
""" | ||
updateTotalSumAction(id: ID!, input: UpdateTotalSumActionInput!): UpdateTotalSumActionPayload! | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
'use strict' | ||
|
||
const { gql } = require('apollo-server-micro') | ||
|
||
module.exports = gql` | ||
enum EventType { | ||
""" | ||
Event that calculates the sum of all action values grouped by day, month or year. | ||
""" | ||
TOTAL_SUM | ||
""" | ||
Event that calculates the sum of all action values of a key, grouped by day, month or year. | ||
""" | ||
KEY_SUM | ||
""" | ||
Event that shows all actions in a chronic order. | ||
""" | ||
LOG | ||
} | ||
""" | ||
Events are required to track actions. You can create as many events as you want. This allows you to analyse specific actions happening on your sites. Like a button click or a successful sale. | ||
""" | ||
type Event { | ||
""" | ||
Event identifier. | ||
""" | ||
id: ID! | ||
""" | ||
Title of the event. | ||
""" | ||
title: String! | ||
""" | ||
Type of the event. | ||
""" | ||
type: EventType! | ||
""" | ||
Identifies the date and time when the object was created. | ||
""" | ||
created: DateTime! | ||
""" | ||
Identifies the date and time when the object was updated. | ||
""" | ||
updated: DateTime! | ||
} | ||
input CreateEventInput { | ||
""" | ||
Title of the event. | ||
""" | ||
title: String! | ||
""" | ||
Type of the event. | ||
""" | ||
type: EventType! | ||
} | ||
type CreateEventPayload { | ||
""" | ||
Indicates that the event creation was successful. Might be 'null' otherwise. | ||
""" | ||
success: Boolean | ||
""" | ||
The newly created event. | ||
""" | ||
payload: Event | ||
} | ||
input UpdateEventInput { | ||
""" | ||
Title of the event. | ||
""" | ||
title: String! | ||
""" | ||
Type of the event. | ||
""" | ||
type: EventType! | ||
} | ||
type UpdateEventPayload { | ||
""" | ||
Indicates that the event update was successful. Might be 'null' otherwise. | ||
""" | ||
success: Boolean | ||
""" | ||
The updated event. | ||
""" | ||
payload: Event | ||
} | ||
type DeleteEventPayload { | ||
""" | ||
Indicates that the event deletion was successful. Might be 'null' otherwise. | ||
""" | ||
success: Boolean | ||
} | ||
type Query { | ||
""" | ||
Data of a specific event. | ||
""" | ||
event(id: ID!): Event | ||
""" | ||
Data of all existing events. | ||
""" | ||
events: [Event!] | ||
} | ||
type Mutation { | ||
""" | ||
Create a new event. | ||
""" | ||
createEvent(input: CreateEventInput!): CreateEventPayload! | ||
""" | ||
Update an existing event. | ||
""" | ||
updateEvent(id: ID!, input: UpdateEventInput!): UpdateEventPayload! | ||
""" | ||
Delete an existing event. | ||
""" | ||
deleteEvent(id: ID!): DeleteEventPayload! | ||
} | ||
` |