Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/daily questions #32

Merged
merged 31 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7e3c56b
edit daily questions cleaner
kish1n Aug 23, 2024
a63a464
edit daily questions cleaner change ctx
kish1n Aug 23, 2024
dea9c03
update to daily_questions_rework
kish1n Aug 25, 2024
9ed3923
add admin flow daily questions
kish1n Aug 26, 2024
c2f7ea7
update docs
kish1n Aug 27, 2024
b685b51
update docs add requests fo dq admin
kish1n Aug 27, 2024
ba1f950
update docs add requests fo dq admin 2
kish1n Aug 27, 2024
a7dc1f5
update docs add requests fo dq admin 3
kish1n Aug 27, 2024
26b0162
update docs add admin route for dq
kish1n Aug 27, 2024
1ec0a37
DQ admin fix
kish1n Aug 27, 2024
b8c90a5
changed the deadline for editing and fixed daily_questin_select
kish1n Aug 27, 2024
d56c0a6
return auth
kish1n Aug 27, 2024
b0870a7
fix bugs with edit question add validate func for options
kish1n Aug 27, 2024
8bd983a
return auth
kish1n Aug 27, 2024
9aa59e5
fix router
kish1n Aug 27, 2024
edca683
add location to DQ admin fix bug with uneditable starts_at
kish1n Aug 28, 2024
f76efa5
before megre main
kish1n Aug 28, 2024
74f523d
Merge remote-tracking branch 'origin/main' into feat/daily_questions
kish1n Aug 28, 2024
ffb898a
megre to origin main
kish1n Aug 28, 2024
91f7041
clean DQ
kish1n Aug 28, 2024
1ce3674
add go.sum go.buil
kish1n Aug 28, 2024
59defa7
fix resp err add return
kish1n Aug 28, 2024
1cbcf96
handle error daily_question_edit
kish1n Aug 28, 2024
d76b8c9
handle error daily_question_create
kish1n Aug 28, 2024
19056e7
Fix options unmarshaling
Zaptoss Aug 28, 2024
afcbebf
fix req
kish1n Aug 28, 2024
864e0bc
fix fix req
kish1n Aug 28, 2024
543a036
change requests
kish1n Aug 29, 2024
1382486
validate type for req in DQ
kish1n Aug 29, 2024
44f57f9
fix the bug with -reward, add description for bad request
kish1n Aug 29, 2024
394e269
fix misspell
kish1n Aug 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/spec/components/schemas/DailyQuestionCreate.yaml
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"
11 changes: 11 additions & 0 deletions docs/spec/components/schemas/DailyQuestionCreateKey.yaml
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 ]
15 changes: 15 additions & 0 deletions docs/spec/components/schemas/DailyQuestionDel.yaml
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
11 changes: 11 additions & 0 deletions docs/spec/components/schemas/DailyQuestionDelKey.yaml
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 ]
77 changes: 77 additions & 0 deletions docs/spec/components/schemas/DailyQuestionDetails.yaml
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
11 changes: 11 additions & 0 deletions docs/spec/components/schemas/DailyQuestionDetailsKey.yaml
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 ]
48 changes: 48 additions & 0 deletions docs/spec/components/schemas/DailyQuestionEdit.yaml
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"
11 changes: 11 additions & 0 deletions docs/spec/components/schemas/DailyQuestionEditKey.yaml
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 ]
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'
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'
Loading
Loading