Skip to content

Commit

Permalink
foundation of stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
chralp committed Jan 6, 2020
1 parent 25008a5 commit bf4aba0
Show file tree
Hide file tree
Showing 49 changed files with 2,743 additions and 1,420 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/types
src/bot.ts
src/database/drivers/Filedriver.ts
src/database/drivers/ArrayDriver.ts
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: ['airbnb-typescript/base'],
"rules": {
"max-len": ["warn", { "code": 140 }],
"quotes": [2, "single", { "avoidEscape": true }],
"@typescript-eslint/indent": ["error", 4],

}
};
117 changes: 84 additions & 33 deletions api.org
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

* API endpoints
** Return object
#+BEGIN_SRC code
Expand All @@ -11,30 +12,42 @@

** /api/scoreboard/

Append given or givers for different scoreboard
Append to or from for different scoreboard

#+BEGIN_SRC http :pretty
GET http://heyburrito:3333/api/scoreboard/given
GET http://heyburrito:3333/api/scoreboard/from
#+END_SRC

#+RESULTS:
#+begin_example
{
"error": false,
"code": 200,
"message": null,
"message": "ok",
"data": [
{
"username": "UEHUXHG0G",
"name": "Stefan",
"score": 6,
"avatar": "https://secure.gravatar.com/avatar/1d9ae0f0ee4c6e66ec367005b82b459b.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0016-48.png"
"username": "USER2",
"name": "User2",
"avatar": "https://link.to.avatar.48.burrito",
"score": 162
},
{
"username": "USER4",
"name": "User4",
"avatar": "https://link.to.avatar.48.burrito",
"score": 160
},
{
"username": "UEKN9GNAJ",
"name": "chralp",
"score": 7,
"avatar": "https://secure.gravatar.com/avatar/c8facda114a361db902d0cbf6481e819.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0006-48.png"
"username": "USER1",
"name": "User1",
"avatar": "https://link.to.avatar.48.burrito",
"score": 144
},
{
"username": "USER3",
"name": "User3",
"avatar": "https://link.to.avatar.48.burrito",
"score": 75
}
]
}
Expand All @@ -45,49 +58,87 @@ GET http://heyburrito:3333/api/scoreboard/given
Append username of the user you want to get more stats from

#+BEGIN_SRC http :pretty
GET http://heyburrito:3333/api/userstats/UEKN9GNAJ
GET http://heyburrito:3333/api/userstats/USER2
#+END_SRC

#+RESULTS:
#+begin_example
{
"error": false,
"code": 200,
"message": null,
"message": "ok",
"data": {
"user": {
"username": "UEKN9GNAJ",
"name": "chralp",
"score": 7,
"given": 13,
"today": 0,
"avatar": "https://secure.gravatar.com/avatar/c8facda114a361db902d0cbf6481e819.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0006-48.png"
"username": "USER2",
"name": "User2",
"avatar": "https://link.to.avatar.48.burrito",
"receivedToday": 0,
"givedToday": 0,
"received": 39,
"gived": 162
},
"gived": [
{
"username": "UEHUXHG0G",
"name": "Stefan",
"score": 6,
"avatar": "https://secure.gravatar.com/avatar/1d9ae0f0ee4c6e66ec367005b82b459b.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0016-48.png"
"username": "USER3",
"name": "User3",
"avatar": "https://link.to.avatar.48.burrito",
"score": 57
},
{
"username": "UEKN9GNAJ",
"name": "chralp",
"score": 7,
"avatar": "https://secure.gravatar.com/avatar/c8facda114a361db902d0cbf6481e819.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0006-48.png"
"username": "USER4",
"name": "User4",
"avatar": "https://link.to.avatar.48.burrito",
"score": 57
},
{
"username": "USER1",
"name": "User1",
"avatar": "https://link.to.avatar.48.burrito",
"score": 48
}
],
"givers": [
"received": [
{
"username": "USER4",
"name": "User4",
"avatar": "https://link.to.avatar.48.burrito",
"score": 57
},
{
"username": "USER1",
"name": "User1",
"avatar": "https://link.to.avatar.48.burrito",
"score": 40
},
{
"username": "UEKN9GNAJ",
"name": "chralp",
"score": 7,
"avatar": "https://secure.gravatar.com/avatar/c8facda114a361db902d0cbf6481e819.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0006-48.png"
"username": "USER3",
"name": "User3",
"avatar": "https://link.to.avatar.48.burrito",
"score": -58
}
]
],
"givedToday": [],
"receivedToday": []
}
}
#+end_example
** /api/userstats/today/
Append username of the user you want to get more stats from

#+BEGIN_SRC http :pretty
GET http://heyburrito:3333/api/userstats/today/USER2
#+END_SRC

#+RESULTS:
: {
: "error": false,
: "code": 200,
: "message": "ok",
: "data": {
: "givedToday": 16,
: "receivedToday": 11
: }
: }

** /api/histogram/ PRE-ALPHA

Expand Down
5 changes: 4 additions & 1 deletion declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
* Declare JS modules that we want to use
*/
declare module 'bog';
declare module 'mongodb';
declare module 'dotenv';
declare module 'path';
declare module '@slack/client';
declare module '@slack/rtm-api';
declare module '@slack/web-api';
declare module 'ws';
declare module 'git-clone-repo';
declare module 'http';
Expand All @@ -13,3 +15,4 @@ declare module 'http';
declare module 'chai';
declare module 'sinon';
declare module 'fs';
declare module 'proxyquire';
Loading

0 comments on commit bf4aba0

Please sign in to comment.