...
POST course/v1/badge/dissociatedisassociate
Code Block |
---|
Request Body :- { "request" : { "courseId" : " ", "badgeId" : " ", "issuerId" : " " } } Response Body :- { "id": "api.course.badge.association", "ver": "v1", "ts": "2019-01-31 11:31:47:381+0530", "params": { "resmsgid": null, "msgid": "8e27cbf5-e299-43b0-bca7-8347f7e5abcf", "err": null, "status": "success", "errmsg": null }, "responseCode": "OK", "result": { "response": "SUCCESS" } } |
Problem Statement 1:
What is the data model for storing badge and course association information?
Proposed Solution 1:
As badge association is course based property and course object is stored inside Learning Platform. We can update the badge details in course object on every associate/dissociate request. The structure of badgeAssociatedInfo of badgeAssociations is as follows:-
content | |
---|---|
badgeAssociatedInfobadgeAssociation | List<Map<textMap<text, text>>text> |
name | data type | Description | |||||
---|---|---|---|---|---|---|---|
1 | issuerId | String | Issues the badge | ||||
2 | badgeId | String | Id of the badge | ||||
3 | associationIdassociatedTS | String | Uniquely identifies the association? | Timestamp at which badge is associated to the course | |||
4 | badgeClassImage | String | badge image url | ||||
5 | badgeClassName | String | name of the badge class | 6 | associatedTS | String | Timestamp at which badge is associated to the course |
7 | status | boolean | True → Batch created corresponding to the course will be imparted this badge. False → This badge is no longer associated with course. There will be at most one status flag of the map inside the badgeAssociatedinfo will be set true for particular course. |
For Association Request :- Iterate over all the badgeAssociatedInfo list from course object and check for status flag as true(if present). Will reset that particular flag to false, adding the new requested badge with status flag as true in course object and update it.
...
name | dataType | description |
---|---|---|
badgeId | String | uniquely identifies the badge. |
issuerId | ||
badgeClassName | ||
badgeClassImage |
Pros | Cons |
---|---|
Isolation of the course related info will be maintained with the LP. | We need to iterate over the list for every association/disassociation/batch-creation request. |
...
We can store the badge association information in new table coursecontent_badge_association. The structure of the table will be :-
name | dataType | description |
---|---|---|
courseIdcontentId* | String | uniquely identifies the courseId |
badgeIId* | String | uniquely identifies the badgeId |
issuerId | String | uniquely identifies the issuerId |
badgeClassImage | String | image url of the badge |
badgeClassName | String | name of the badge |
associatedTScreatedOn | Timestamp | Timestamp at which the badge is associated with the courseId |
status | boolean | states badge is currently associated to the course or not. Needs to be indexed. |
updatedTSlastUpdatedOn | TimeStamp | Timestamp at which badge association is updated. |
createdBy | ||
lastUpdatedBy |
composite primary key :- (courseId, badgeId)
...