Skip to content

Commit

Permalink
Contest creation on backend (#964)
Browse files Browse the repository at this point in the history
* Contest creation on backend

### What's done:
 * Added endpoint for contest creation
 * Added column for organization table - a flag that indicates whether an organization can create contests or not
 * Added column for contest table - id of an organization that has created this contest
 * Reworked LnkUserOrganizationController - made it reactive
 * Added swagger annotations for LnkUserOrganizationController
 * Added swagger annotations for ContestController
 * Updated dev database insertions
 * Updated diktat-analysis.yml

(#959)

* Update backend-api-docs.json

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kirill Gevorkyan <[email protected]>
  • Loading branch information
3 people authored Jul 25, 2022
1 parent f27a176 commit 79112b5
Show file tree
Hide file tree
Showing 19 changed files with 1,229 additions and 270 deletions.
1 change: 1 addition & 0 deletions db/v-2/insert-test-data/contest-insert.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<column header="start_time" name="start_time" type="timestamp"/>
<column header="end_time" name="end_time" type="timestamp"/>
<column header="description" name="description" type="varchar(1024)"/>
<column header="organization_id" name="organization_id" type="bigint"/>
</loadData>
</changeSet>

Expand Down
10 changes: 5 additions & 5 deletions db/v-2/insert-test-data/organization-insert.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<changeSet id="organization-insert" author="frolov" context="dev">

<loadData tableName="organization" encoding="UTF-8" separator=";" quotchar="&quot;" file="db/v-2/insert-test-data/sqlRequests/organization.csv">
<column header="id" name="id" type="NUMERIC" />
<column header="name" name="name" type="STRING" />
<column header="owner_id" name="owner_id" type="NUMERIC" />
<column header="date_created" name="date_created" type="DATE" />
<column header="id" name="id" type="NUMERIC"/>
<column header="name" name="name" type="STRING"/>
<column header="owner_id" name="owner_id" type="NUMERIC"/>
<column header="date_created" name="date_created" type="DATE"/>
<column header="can_create_contests" name="can_create_contests" type="boolean"/>
</loadData>

</changeSet>

</databaseChangeLog>
12 changes: 6 additions & 6 deletions db/v-2/insert-test-data/sqlRequests/contest.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id;name;status;start_time;end_time;description
1;"ActiveContest1";"CREATED";"2021-01-01 00:00:00";"2025-01-01 00:00:00";"Test Contest 1"
2;"ActiveContest2";"CREATED";"2021-06-15 09:15:00";"2023-01-01 00:00:00";"Test Contest 2"
3;"FinishedContest1";"CREATED";"2021-06-15 09:15:00";"2022-06-15 09:15:00";"Finished Contest 1"
4;"FinishedContest2";"CREATED";"2021-01-01 00:00:00";"2022-01-15 09:15:00";"Finished Contest 2"
5;"DeletedContest";"DELETED";"2021-01-01 00:00:00";"2023-01-01 00:00:00";"Deleted Contest"
id;name;status;start_time;end_time;description;organization_id
1;"ActiveContest1";"CREATED";"2021-01-01 00:00:00";"2025-01-01 00:00:00";"Test Contest 1";1
2;"ActiveContest2";"CREATED";"2021-06-15 09:15:00";"2023-01-01 00:00:00";"Test Contest 2";1
3;"FinishedContest1";"CREATED";"2021-06-15 09:15:00";"2022-06-15 09:15:00";"Finished Contest 1";1
4;"FinishedContest2";"CREATED";"2021-01-01 00:00:00";"2022-01-15 09:15:00";"Finished Contest 2";2
5;"DeletedContest";"DELETED";"2021-01-01 00:00:00";"2023-01-01 00:00:00";"Deleted Contest";1
6 changes: 3 additions & 3 deletions db/v-2/insert-test-data/sqlRequests/organization.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
id;name;owner_id;date_created
1;"Huawei";1;"2021-01-01 00:00:00"
2;"Example.com";1;"2021-01-01 00:00:00"
id;name;owner_id;date_created;can_create_contests
1;"Huawei";1;"2021-01-01 00:00:00";true
2;"Example.com";1;"2021-01-01 00:00:00";false
9 changes: 9 additions & 0 deletions db/v-2/tables/contest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,13 @@
</column>
</addColumn>
</changeSet>

<changeSet id="add-organization_id-column" author="sanyavertolet">
<addColumn tableName="contest">
<column name="organization_id" type="bigint">
<constraints foreignKeyName="fk_contest_organization" references="organization(id)" nullable="false"/>
</column>
</addColumn>

</changeSet>
</databaseChangeLog>
5 changes: 5 additions & 0 deletions db/v-2/tables/organization.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@
</addColumn>
</changeSet>

<changeSet id="organization-6" author="sanyavertolet" context="dev or prod">
<addColumn tableName="organization">
<column name="can_create_contests" type="boolean" defaultValue="0"/>
</addColumn>
</changeSet>
</databaseChangeLog>
12 changes: 11 additions & 1 deletion diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,14 @@
enabled: true
- name: USE_DATA_CLASS
ignoreAnnotated:
- Entity
- Entity
- name: MISSING_KDOC_CLASS_ELEMENTS
ignoreAnnotated:
- Operation
- Parameters
- Parameter
- name: MISSING_KDOC_ON_FUNCTION
ignoreAnnotated:
- Operation
- Parameters
- Parameter
Loading

0 comments on commit 79112b5

Please sign in to comment.