-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* edit daily questions cleaner * edit daily questions cleaner change ctx * add admin flow daily questions * update docs * update docs add requests fo dq admin * update docs add requests fo dq admin 2 * update docs add requests fo dq admin 3 * update docs add admin route for dq * DQ admin fix * changed the deadline for editing and fixed daily_questin_select * return auth * fix bugs with edit question add validate func for options * return auth * fix router * add location to DQ admin fix bug with uneditable starts_at * before megre main * megre to origin main * clean DQ * add go.sum go.buil * fix resp err add return * handle error daily_question_edit * handle error daily_question_create * Fix options unmarshaling * fix req * fix fix req * change requests * validate type for req in DQ * fix the bug with -reward, add description for bad request * fix misspell --------- Co-authored-by: Zaptoss <[email protected]>
- Loading branch information
Showing
30 changed files
with
1,377 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
allOf: | ||
- $ref: "#/components/schemas/DailyQuestionEditKey" | ||
- type: object | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
type: object | ||
required: | ||
- title | ||
- reward | ||
- options | ||
- correct_answer | ||
- time_for_answer | ||
- starts_at | ||
properties: | ||
title: | ||
type: string | ||
description: Question title | ||
example: Georgian capital | ||
reward: | ||
type: integer | ||
format: int64 | ||
description: Reward for a correct answer | ||
options: | ||
type: array | ||
description: Answer options. Minimum 2, maximum 6 | ||
items: | ||
$ref: "#/components/schemas/DailyQuestionOptions" | ||
example: [ | ||
{ | ||
"id": 0, | ||
"title": "" | ||
}, | ||
{ | ||
"id": 1, | ||
"title": "" | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "" | ||
} | ||
] | ||
correct_answer: | ||
type: integer | ||
format: int64 | ||
description: Correct answer ID | ||
time_for_answer: | ||
type: integer | ||
format: int64 | ||
description: Time for answer | ||
starts_at: | ||
type: string | ||
description: Start date when this question is available, hours and minutes are always 0 | ||
example: "2024-08-23" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type: object | ||
required: | ||
- id | ||
- type | ||
properties: | ||
id: | ||
type: string | ||
description: Question id | ||
type: | ||
type: string | ||
enum: [ daily_questions ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
allOf: | ||
- $ref: "#/components/schemas/DailyQuestionDelKey" | ||
- type: object | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
type: object | ||
required: | ||
- title | ||
properties: | ||
title: | ||
type: string | ||
description: Question title | ||
example: Georgian capital |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type: object | ||
required: | ||
- id | ||
- type | ||
properties: | ||
id: | ||
type: string | ||
description: Question id | ||
type: | ||
type: string | ||
enum: [ daily_questions ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
allOf: | ||
- $ref: "#/components/schemas/DailyQuestionDetailsKey" | ||
- type: object | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
type: object | ||
required: | ||
- title | ||
- reward | ||
- options | ||
- correct_answer | ||
- time_for_answer | ||
- starts_at | ||
- created_at | ||
- num_correct_answers | ||
- num_incorrect_answers | ||
- num_all_participants | ||
properties: | ||
title: | ||
type: string | ||
description: Question title | ||
example: Georgian capital | ||
reward: | ||
type: integer | ||
format: int64 | ||
description: Reward for a correct answer | ||
options: | ||
type: array | ||
description: Answer options. Minimum 2, maximum 6 | ||
items: | ||
$ref: "#/components/schemas/DailyQuestionOptions" | ||
example: [ | ||
{ | ||
"id": 0, | ||
"title": "" | ||
}, | ||
{ | ||
"id": 1, | ||
"title": "" | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "" | ||
} | ||
] | ||
correct_answer: | ||
type: integer | ||
format: int64 | ||
description: Correct answer ID | ||
time_for_answer: | ||
type: integer | ||
format: int64 | ||
description: Time for answer | ||
starts_at: | ||
type: string | ||
description: Start date when this question is available, hours and minutes are always 0 | ||
example: "2024-08-26T00:00:00Z" | ||
created_at: | ||
type: string | ||
description: Start date when this question was create | ||
example: "2024-08-26T00:00:00Z" | ||
num_correct_answers: | ||
type: integer | ||
format: int64 | ||
description: Number of correct answers | ||
num_incorrect_answers: | ||
type: integer | ||
format: int64 | ||
description: Number of incorrect answers | ||
num_all_participants: | ||
type: integer | ||
format: int64 | ||
description: | | ||
Users who received the question, those who answered and | ||
those who did not answer in the time given to them |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type: object | ||
required: | ||
- id | ||
- type | ||
properties: | ||
id: | ||
type: string | ||
description: Question id | ||
type: | ||
type: string | ||
enum: [ daily_questions ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
allOf: | ||
- $ref: "#/components/schemas/DailyQuestionEditKey" | ||
- type: object | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
type: object | ||
properties: | ||
title: | ||
type: string | ||
description: Question title | ||
example: Georgian capital | ||
reward: | ||
type: integer | ||
format: int64 | ||
description: Reward for a correct answer | ||
options: | ||
type: array | ||
description: Answer options. Minimum 2, maximum 6 | ||
items: | ||
$ref: "#/components/schemas/DailyQuestionOptions" | ||
example: [ | ||
{ | ||
"id": 0, | ||
"title": "" | ||
}, | ||
{ | ||
"id": 1, | ||
"title": "" | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "" | ||
} | ||
] | ||
correct_answer: | ||
type: integer | ||
format: int64 | ||
description: Correct answer ID | ||
time_for_answer: | ||
type: integer | ||
format: int64 | ||
description: Time for answer | ||
starts_at: | ||
type: string | ||
description: Start date when this question is available, hours and minutes are always 0 | ||
example: "2024-08-23" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type: object | ||
required: | ||
- id | ||
- type | ||
properties: | ||
id: | ||
type: string | ||
description: Question id | ||
type: | ||
type: string | ||
enum: [ daily_questions ] |
69 changes: 69 additions & 0 deletions
69
docs/spec/paths/integrations@geo-points-svc@v1@public@[email protected]
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
post: | ||
tags: | ||
- Daily Questions | ||
summary: Create daily question | ||
description: | | ||
Create Daily Question user must be superuser | ||
operationId: createDailyQuestion | ||
security: | ||
- BearerAuth: [] | ||
requestBody: | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/DailyQuestionCreate' | ||
responses: | ||
200: | ||
description: Success | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/DailyQuestionDetails' | ||
400: | ||
$ref: '#/components/responses/invalidParameter' | ||
401: | ||
$ref: '#/components/responses/invalidAuth' | ||
409: | ||
description: On this day, the daily question already exists | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
$ref: '#/components/schemas/Errors' | ||
500: | ||
$ref: '#/components/responses/internalError' | ||
|
||
get: | ||
tags: | ||
- Daily Questions | ||
summary: Filter Daily Question by start | ||
description: | | ||
Filtering of daily questions by their activation time | ||
operationId: filterStartAtDailyQuestion | ||
security: | ||
- BearerAuth: [] | ||
responses: | ||
200: | ||
description: Success | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/DailyQuestionDetails' | ||
500: | ||
$ref: '#/components/responses/internalError' |
77 changes: 77 additions & 0 deletions
77
...spec/paths/integrations@geo-points-svc@v1@public@daily_questions@admin@{question_id}.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
delete: | ||
tags: | ||
- Daily Questions | ||
summary: Delete daily question | ||
description: | | ||
Delete Daily Question user must be superuser | ||
operationId: deleteDailyQuestion | ||
security: | ||
- BearerAuth: [] | ||
responses: | ||
200: | ||
description: Success | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/DailyQuestionDetails' | ||
204: | ||
description: No content | ||
400: | ||
$ref: '#/components/responses/invalidParameter' | ||
404: | ||
description: Question with ID not found | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
$ref: '#/components/schemas/Errors' | ||
500: | ||
$ref: '#/components/responses/internalError' | ||
|
||
patch: | ||
tags: | ||
- Daily Questions | ||
summary: Edit daily question | ||
description: | | ||
Edit Daily Question user must be superuser | ||
operationId: editDailyQuestion | ||
security: | ||
- BearerAuth: [] | ||
requestBody: | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/DailyQuestionEdit' | ||
responses: | ||
204: | ||
description: No content | ||
200: | ||
description: Success | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: '#/components/schemas/DailyQuestionDetails' | ||
400: | ||
$ref: '#/components/responses/invalidParameter' | ||
409: | ||
description: On this day, the daily question already exists | ||
content: | ||
application/vnd.api+json: | ||
schema: | ||
$ref: '#/components/schemas/Errors' | ||
500: | ||
$ref: '#/components/responses/internalError' |
Oops, something went wrong.