Last active
January 2, 2018 13:25
-
-
Save gippy/e5b49d2370ae4dfaa7588d7b270f911e to your computer and use it in GitHub Desktop.
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
class Reporting { | |
# DI of database connection | |
constructor(db) {} | |
getStore(store) { | |
find document with id of store | |
return the document | |
} | |
afterPush(store) { | |
update document with id of store | |
increase itemsCount by 1 ($inc) | |
return updated document | |
} | |
beforePersist(store, newlyPersistedItemsCount) { | |
update document with id of store | |
increase persistedItemsCount by newlyPersistedItemsCount ($inc) | |
return updated document | |
} | |
afterPersist(store, key, fields, newlyUploadedBytes) { | |
update document with id of store | |
add key to set of keys ($addToSet) | |
add fields to set of field ($addToSet) | |
increase s3PutCount by 1 ($inc) | |
increase uploadedBytes by newlyUploadedBytes ($inc) | |
return updated document | |
} | |
afterDownload(store, newly downloadedBytes) { | |
update document with id of store | |
increase s3GetCount by 1 ($inc) | |
increase downloadedBytes by newlyDownloadedBytes ($inc) | |
return updated document | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment