Skip to content

Commit

Permalink
feat: update database schema and openapi for targets and admins
Browse files Browse the repository at this point in the history
  • Loading branch information
Eraxyso authored Jan 23, 2025
1 parent de91f69 commit 81fe2bd
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 94 deletions.
36 changes: 36 additions & 0 deletions docs/db_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@
| questionnaire_id | int(11) | NO | PRI | _NULL_ |
| user_traqid | char(32) | NO | PRI | _NULL_ |

### administrator_groups

アンケートの運営 (編集等ができるグループ)(実際の管理はadministratorsで行い、これは前回選択した内容を提示するためのみに使用される)

| Field | Type | Null | Key | Default | Extra | 説明など |
| ---------------- | -------- | ---- | --- | ------- | ----- | -------- |
| questionnaire_id | int(11) | NO | PRI | _NULL_ |
| group_id | char(36) | NO | PRI | _NULL_ |

### administrator_users

アンケートの運営 (編集等ができるユーザー)(実際の管理はadministratorsで行い、これは前回選択した内容を提示するためのみに使用される)

| Field | Type | Null | Key | Default | Extra | 説明など |
| ---------------- | -------- | ---- | --- | ------- | ----- | -------- |
| questionnaire_id | int(11) | NO | PRI | _NULL_ |
| user_traqid | char(32) | NO | PRI | _NULL_ |

### options

選択肢
Expand Down Expand Up @@ -110,3 +128,21 @@
| questionnaire_id | int(11) | NO | PRI | _NULL_ |
| user_traqid | char(32) | NO | PRI | _NULL_ |
| is_canceled | boolean | NO | | false | | アンケートの対象者がキャンセルしたかどうか |

### target_groups

選択したアンケートの対象者(グループ)(実際の管理はtargetsで行い、これは前回選択した内容を提示するためのみに使用される)

| Field | Type | Null | Key | Default | Extra | 説明など |
| ---------------- | -------- | ---- | --- | ------- | ----- | -------- |
| questionnaire_id | int(11) | NO | PRI | _NULL_ |
| group_id | char(36) | NO | PRI | _NULL_ |

### target_groups

選択したアンケートの対象者(ユーザー)(実際の管理はtargetsで行い、これは前回選択した内容を提示するためのみに使用される)

| Field | Type | Null | Key | Default | Extra | 説明など |
| ---------------- | -------- | ---- | --- | ------- | ----- | -------- |
| questionnaire_id | int(11) | NO | PRI | _NULL_ |
| user_traqid | char(32) | NO | PRI | _NULL_ |
51 changes: 44 additions & 7 deletions docs/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ paths: # TODO 変数の命名を確認する
content:
application/json:
schema:
$ref: "#/components/schemas/QuestionnaireDetail"
$ref: "#/components/schemas/EditQuestionnaire"
responses:
"200":
description: 正常にアンケートを変更できました。
Expand Down Expand Up @@ -428,29 +428,55 @@ components:
- $ref: "#/components/schemas/QuestionnaireIsAnonymous"
- $ref: "#/components/schemas/QuestionnaireIsDuplicateAnswerAllowed"
- $ref: "#/components/schemas/QuestionnaireIsPublished"
- $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins"
NewQuestionnaire:
allOf:
- $ref: "#/components/schemas/QuestionnaireBase"
- $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins"
- properties:
questions:
type: array
items:
$ref: "#/components/schemas/NewQuestion"
required:
- questions
- targets
- admins
EditQuestionnaire:
allOf:
- $ref: "#/components/schemas/QuestionnaireID"
- $ref: "#/components/schemas/QuestionnaireBase"
- $ref: "#/components/schemas/EditQuestionnaireTargetsAndAdmins"
- properties:
questions:
type: array
items:
$ref: "#/components/schemas/Question"
required:
- questions
QuestionnaireDetail:
allOf:
- $ref: "#/components/schemas/QuestionnaireID"
- $ref: "#/components/schemas/QuestionnaireBase"
- $ref: "#/components/schemas/QuestionnaireCreatedAt"
- $ref: "#/components/schemas/QuestionnaireModifiedAt"
- $ref: "#/components/schemas/Users"
- $ref: "#/components/schemas/QuestionnaireTargetsAndAdmins"
- properties:
questions:
type: array
items:
$ref: "#/components/schemas/Question"
respondents:
$ref: "#/components/schemas/Users"
description: |

Check failure on line 470 in docs/swagger/swagger.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-$ref-siblings

$ref must not be placed next to any other properties
回答者の一覧。匿名回答の場合はnull。
targets:
$ref: "#/components/schemas/Users"
description: |

Check failure on line 474 in docs/swagger/swagger.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-$ref-siblings

$ref must not be placed next to any other properties
対象者の一覧。
admins:
$ref: "#/components/schemas/Users"
description: |

Check failure on line 478 in docs/swagger/swagger.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-$ref-siblings

$ref must not be placed next to any other properties
管理者の一覧。
required:
- questions
- respondents
Expand Down Expand Up @@ -602,13 +628,24 @@ components:
QuestionnaireTargetsAndAdmins:
type: object
properties:
targets:
target:
$ref: "#/components/schemas/UsersAndGroups"
admins:
admin:
$ref: "#/components/schemas/UsersAndGroups"
required:
- targets
- admins
- target
- admin
EditQuestionnaireTargetsAndAdmins:
type: object
properties:
target:
$ref: "#/components/schemas/UsersAndGroups"
description: |

Check failure on line 643 in docs/swagger/swagger.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-$ref-siblings

$ref must not be placed next to any other properties
nullの場合は対象者を変更しない。
admin:
$ref: "#/components/schemas/UsersAndGroups"
description: |

Check failure on line 647 in docs/swagger/swagger.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

no-$ref-siblings

$ref must not be placed next to any other properties
nullの場合は管理者を変更しない。
QuestionnaireIsRemindEnabled:
type: object
properties:
Expand Down
139 changes: 70 additions & 69 deletions openapi/spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 81fe2bd

Please sign in to comment.