Skip to content

Commit

Permalink
Merge pull request #84 from topcoder-platform/develop
Browse files Browse the repository at this point in the history
Gamification
  • Loading branch information
kkartunov authored Jun 23, 2022
2 parents be3208d + b2b20b7 commit 6b14bd1
Show file tree
Hide file tree
Showing 12 changed files with 1,602 additions and 921 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ workflows:
branches:
only:
- develop
- feat/create-skill-obj

- feature/gamification
# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typings/

# dotenv environment variables file
.env
.env.sh

# next.js build output
.next
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v8.9.2
9 changes: 8 additions & 1 deletion app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ const TOPICS = {

const ES_SEARCH_MAX_SIZE = 9999

const MAMBO_GET_REWARDS_ALLOWED_FIELDS = [
'awarded.awardedType', 'awarded.message', 'awarded.name', 'awarded.type',
'awarded.reward.active', 'awarded.reward.attrs', 'awarded.reward.id', 'awarded.reward.imageUrl', 'awarded.reward.mimeType', 'awarded.reward.hint', 'awarded.reward.message',
'awardedOn', 'expiryOn', 'isExpired', 'id'
]

module.exports = {
ADMIN_ROLES,
EVENT_ORIGINATOR,
EVENT_MIME_TYPE,
TOPICS,
ES_SEARCH_MAX_SIZE
ES_SEARCH_MAX_SIZE,
MAMBO_GET_REWARDS_ALLOWED_FIELDS
}
8 changes: 7 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,11 @@ module.exports = {
// Private group ids will be excluded from results for non-admin users.
PRIVATE_GROUP_IDS: JSON.parse(process.env.PRIVATE_GROUP_IDS || '["20000000"]'),
// id of the tcwebservice user, used to audit fields in case of m2m tokens
TC_WEBSERVICE_USERID: process.env.TC_WEBSERVICE_USERID || 22838965
TC_WEBSERVICE_USERID: process.env.TC_WEBSERVICE_USERID || 22838965,

// Gamification
MAMBO_PUBLIC_KEY: process.env.MAMBO_PUBLIC_KEY,
MAMBO_PRIVATE_KEY: process.env.MAMBO_PRIVATE_KEY,
MAMBO_DOMAIN_URL: process.env.MAMBO_DOMAIN_URL,
MAMBO_DEFAULT_SITE: process.env.MAMBO_DEFAULT_SITE
}
65 changes: 33 additions & 32 deletions docs/member-api.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"info": {
"_postman_id": "2e554101-d99e-4522-8ce5-39ff8e6cca0e",
"_postman_id": "9f8d8103-0043-4959-b0cf-8e833845cc57",
"name": "member-api",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "10740"
},
"item": [
{
Expand Down Expand Up @@ -1223,12 +1224,7 @@
"type": "file",
"src": "/Users/at397596/Documents/Workspace/Topcoder/member-api-repository/member-api/docs/member_photo.png"
}
],
"options": {
"raw": {
"language": "json"
}
}
]
},
"url": {
"raw": "{{URL}}/members/upbeat/photo",
Expand Down Expand Up @@ -1281,12 +1277,7 @@
],
"body": {
"mode": "formdata",
"formdata": [],
"options": {
"raw": {
"language": "json"
}
}
"formdata": []
},
"url": {
"raw": "{{URL}}/members/upbeat/photo",
Expand Down Expand Up @@ -1340,12 +1331,7 @@
"type": "file",
"src": "/Users/at397596/Documents/Workspace/Topcoder/member-api-repository/member-api/docs/member_photo.png"
}
],
"options": {
"raw": {
"language": "json"
}
}
]
},
"url": {
"raw": "{{URL}}/members/upbeat/photo",
Expand Down Expand Up @@ -1404,12 +1390,7 @@
"type": "file",
"src": "/Users/at397596/Documents/Workspace/Topcoder/member-api-repository/member-api/docs/member_photo.png"
}
],
"options": {
"raw": {
"language": "json"
}
}
]
},
"url": {
"raw": "{{URL}}/members/invalid/photo",
Expand Down Expand Up @@ -1468,12 +1449,7 @@
"type": "file",
"src": "/Users/at397596/Documents/Workspace/Topcoder/member-api-repository/member-api/docs/member_photo.png"
}
],
"options": {
"raw": {
"language": "json"
}
}
]
},
"url": {
"raw": "{{URL}}/members/upbeat/photo",
Expand Down Expand Up @@ -7237,6 +7213,31 @@
}
}
]
},
{
"name": "Gamification",
"item": [
{
"name": "Get member rewards",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{URL}}/members/tourist/gamification/rewards",
"host": [
"{{URL}}"
],
"path": [
"members",
"tourist",
"gamification",
"rewards"
]
}
},
"response": []
}
]
}
],
"event": [
Expand Down
101 changes: 101 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,68 @@ paths:
description: Internal server error
schema:
$ref: '#/definitions/ErrorModel'
'/members/{handle}/gamification/rewards':
get:
tags:
- Gamification
description: Get member gamification rewards
security:
- bearer: []
parameters:
- in: path
name: handle
required: true
type: string
- name: site
in: query
required: false
type: string
description: The site for which to make the request. Defaults to `topcoder` if not specified.
- name: tags
in: query
required: false
type: string
description: >
tags=tag1,tag2,...,tagN
The tags by which to filter the activities retrieved. Leave empty for no tag filtering.
- name: tagsJoin
in: query
required: false
type: string
description: >
Whether the tags should be found using hasAnyOf / hasAllOf.
+ hasAnyOf
+ hasAllOf
responses:
'200':
description: OK
schema:
type: array
items:
$ref: '#/definitions/MemberRewards'
'400':
description: Bad request data
schema:
$ref: '#/definitions/ErrorModel'
'401':
description: Miss or wrong authentication credentials
schema:
$ref: '#/definitions/ErrorModel'
'403':
description: No permission
schema:
$ref: '#/definitions/ErrorModel'
'404':
description: Not found
schema:
$ref: '#/definitions/ErrorModel'
'500':
description: Internal server error
schema:
$ref: '#/definitions/ErrorModel'



Expand Down Expand Up @@ -2226,6 +2288,45 @@ definitions:
type: string
updatedBy:
type: string
MemberRewards:
type: object
properties:
awardedOn:
type: string
expiryOn:
type: string
isExpired:
type: boolean
id:
type: string
awarded:
type: object
properties:
awardedType:
type: string
message:
type: string
name:
type: string
type:
type: string
reward:
type: object
properties:
active:
type: boolean
attrs:
type: object
id:
type: string
imageUrl:
type: string
mimeType:
type: string
message:
type: string
hint:
type: string
ErrorModel:
type: object
properties:
Expand Down
Loading

0 comments on commit 6b14bd1

Please sign in to comment.