# SIT ICT Challenge ## Table of Contents [ToC] ## Plans - [x] Work plan - [ ] Initialize project structure (expected Oct 28) - [ ] All functionality (expected Nov 6) - [ ] Testing (expected Nov 13) - [ ] Production (Nov 21) ## Modules | Module | Assignee | | -------- | -------- | | Leaderboard Page | Float | | Card Page | Jiw | | Admin Page | Art | | Student Page | Cream | | Backend (Core) | Mixko | | Backend (REST) | Thun | | Backend (WS) | Ann | | Design | Mel | # API Specification ## Leaderboard ### State (WS) - Event `lb/state` - Example payload 1 ```json { "rankings": [ { "id": 1, "name": "KUSK KPS", "score": 0 }, { "id": 2, "name": "MTT", "score": 0 }, { "id": 3, "name": "SES", "score": 0 }, { "id": 4, "name": "BJ", "score": 0 }, { "id": 5, "name": "SSRU", "score": 0 }, { "id": 6, "name": "SWS", "score": 0 } ] } ``` - Example payload 2 ```json { "rankings": [ { "id": 3, "name": "SES", "score": 500 }, { "id": 6, "name": "SWS", "score": 400 }, { "id": 1, "name": "KUSK KPS", "score": 300 }, { "id": 5, "name": "SSRU", "score": 300 }, { "id": 2, "name": "MTT", "score": 100 }, { "id": 4, "name": "BJ", "score": -300 }, ] } ``` ### Podium (WS) - Event `lb/podium` - Example payload 1 ```json { "rankings": [ { "id": 3, "name": "SES", "percentile": 1 }, { "id": 6, "name": "SWS", "percentile": 0.875 }, { "id": 1, "name": "KUSK KPS", "percentile": 0.75 }, { "id": 5, "name": "SSRU", "percentile": 0.75 }, { "id": 2, "name": "MTT", "percentile": 0.5 }, { "id": 4, "name": "BJ", "percentile": 0 }, ] } ``` ## Card ### State (WS) - Event `cd/state` - Example payload 1 ```json { "mode": "rule", "rules": [ "Rules 1", "Rules 1", "Rules 1", "Rules 1", "Rules 1", ] } ``` - Example payload 2 ```json { "mode": "topic", "topics": [ { "title": "Web Development", "cards": [ { "id": 1, "score": 100, "opened": false }, { "id": 2, "score": 200, "opened": true }, { "id": 3, "score": 300, "opened": true }, { "id": 4, "score": 400, "opened": false } ] }, { "title": "Cloud & Information Technology", "cards": [ { "id": 5, "score": 100, "opened": false }, { "id": 6, "score": 200, "opened": true }, { "id": 7, "score": 300, "opened": true }, { "id": 8, "score": 400, "opened": false } ] }, { "title": "Artificial Intelligence & IoT", "cards": [ { "id": 9, "score": 100, "opened": false }, { "id": 10, "score": 200, "opened": true }, { "id": 11, "score": 300, "opened": true }, { "id": 12, "score": 400, "opened": false } ] }, { "title": "Data Structure & Algorithm", "cards": [ { "id": 13, "score": 100, "opened": false }, { "id": 14, "score": 200, "opened": true }, { "id": 15, "score": 300, "opened": true }, { "id": 16, "score": 400, "opened": false } ] }, { "title": "Infrastructure & Database", "cards": [ { "id": 17, "score": 100, "opened": false }, { "id": 18, "score": 200, "opened": true }, { "id": 19, "score": 300, "opened": true }, { "id": 20, "score": 400, "opened": false } ] } ] } ``` ### Open Problem (WS) - Event `cd/open` - Example payload ```json { "topic_id": 2, "card_id": 2, "question": "What's the result of 1+1?", "bonus": true } ``` ## Admin ### State (WS) - Event `am/state` - Example payload 1 ```json { "status": "pending" } ``` - Example payload 2 ```json { "status": "playing", "current_question": "Who are we?" } ``` ### Info (REST) - Endpoint `GET` `/am/info` - Header `Authorization: Bearer 72FzHyzDpwK63HM5` - Response ```json { "success": true, "data": { "teams": [ { "id": 0, "name": "SIT Team 1", "logs": [ { "change": 0, "total": 200 }, { "change": 300, "total": 500 } ] } ] } } ``` ### Update score (REST) - Endpoint `PATCH` `/am/score` - Header `Authorization: Bearer 72FzHyzDpwK63HM5` - Request ```json { "update": [-1, 0, 1, 1, 0, 1] } ``` - Response ```json { "success": true, "message": "Successfully updated score record" } ``` ### [Deprecated] ~~Patch Questions (REST)~~ - Endpoint `PATCH` `/am/questions` - Request > The same structure as the get questions endpoint ## Student ### Turn state (WS) - Event `st/turn` - Example payload 1 ```json { "name": "KUSK KPS", "current": false } ``` - Example payload 2 ```json { "name": "KUSK KPS", "current": true, "topics": [ { "title": "Web Development", "cards": [ { "id": 1, "score": 100, "opened": false }, { "id": 2, "score": 200, "opened": true }, { "id": 3, "score": 300, "opened": true }, { "id": 4, "score": 400, "opened": false } ] }, { "title": "Cloud & Information Technology", "cards": [ { "id": 5, "score": 100, "opened": false }, { "id": 6, "score": 200, "opened": true }, { "id": 7, "score": 300, "opened": true }, { "id": 8, "score": 400, "opened": false } ] }, { "title": "Artificial Intelligence & IoT", "cards": [ { "id": 9, "score": 100, "opened": false }, { "id": 10, "score": 200, "opened": true }, { "id": 11, "score": 300, "opened": true }, { "id": 12, "score": 400, "opened": false } ] }, { "title": "Data Structure & Algorithm", "cards": [ { "id": 13, "score": 100, "opened": false }, { "id": 14, "score": 200, "opened": true }, { "id": 15, "score": 300, "opened": true }, { "id": 16, "score": 400, "opened": false } ] }, { "title": "Infrastructure & Database", "cards": [ { "id": 17, "score": 100, "opened": false }, { "id": 18, "score": 200, "opened": true }, { "id": 19, "score": 300, "opened": true }, { "id": 20, "score": 400, "opened": false } ] } ] } ``` ### Open card (REST) - Endpoint `PUT` `/st/open` - Header `Authorization: Bearer 1.72FzHyzDpwK63HM5` - Format `{TEAM_ID}.{TOKEN}` - Request ```json { "topic_id": 2, "card_id": 3 } ``` - Response ```json { "success": true, } ``` ```json { "success": false, "message": "The card has already opened" } ```