Skip to content

Commit

Permalink
Merge pull request #18 from sea-kg/feature/change_id_to_uuid
Browse files Browse the repository at this point in the history
Change id to uuid #14
  • Loading branch information
IgorPolyakov committed Jun 22, 2024
2 parents 708802a + 07a1666 commit 3f9e465
Show file tree
Hide file tree
Showing 24 changed files with 475 additions and 276 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ remove-db:

# Attach to the running PostgreSQL container
attach-db:
docker exec -it ctf01d-postgres psql -U postgres
docker exec -it ctf01d-postgres psql -U postgres -d ctf01d_training_platform

# Generate Go server boilerplate from OpenAPI 3
codegen:
Expand Down
96 changes: 58 additions & 38 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,21 @@ paths:
description: Bad request
'500':
description: Failed response
'/api/v1/users/{id}':
'/api/v1/users/{uuid}':
get:
tags:
- Users
summary: Get a user by ID
operationId: getUserById
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Detailed information of a user
Expand All @@ -191,13 +192,14 @@ paths:
summary: Update a user
operationId: updateUser
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
requestBody:
content:
application/json:
Expand All @@ -217,13 +219,14 @@ paths:
summary: Delete a user
operationId: deleteUser
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: User deleted successfully
Expand Down Expand Up @@ -270,20 +273,21 @@ paths:
description: Bad request
'500':
description: Failed response
'/api/v1/games/{id}':
'/api/v1/games/{uuid}':
get:
tags:
- Games
summary: Get a game by ID
operationId: getGameById
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Detailed information of a game
Expand All @@ -301,13 +305,14 @@ paths:
summary: Update a game
operationId: updateGame
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
requestBody:
content:
application/json:
Expand All @@ -333,13 +338,14 @@ paths:
summary: Delete a game
operationId: deleteGame
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Game deleted successfully
Expand Down Expand Up @@ -399,20 +405,21 @@ paths:
content:
application/json:
schema: {}
'/api/v1/teams/{id}':
'/api/v1/teams/{uuid}':
get:
tags:
- Teams
summary: Get a team by ID
operationId: getTeamById
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Detailed information of a team
Expand All @@ -426,13 +433,14 @@ paths:
summary: Update a team
operationId: updateTeam
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
requestBody:
content:
application/json:
Expand All @@ -448,13 +456,14 @@ paths:
summary: Delete a team
operationId: deleteTeam
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Team deleted successfully
Expand Down Expand Up @@ -490,20 +499,21 @@ paths:
responses:
'200':
description: Result created successfully
'/api/v1/results/{id}':
'/api/v1/results/{uuid}':
get:
tags:
- Results
summary: Get a result by ID
operationId: getResultById
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Detailed information of a result
Expand Down Expand Up @@ -543,20 +553,21 @@ paths:
responses:
'200':
description: Service created successfully
'/api/v1/services/{id}':
'/api/v1/services/{uuid}':
get:
tags:
- Services
summary: Get a service by ID
operationId: getServiceById
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Detailed information of a service
Expand All @@ -570,13 +581,14 @@ paths:
summary: Update a service
operationId: updateService
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
requestBody:
content:
application/json:
Expand All @@ -592,13 +604,14 @@ paths:
summary: Delete a service
operationId: deleteService
parameters:
- name: id
- name: uuid
in: path
required: true
style: simple
explode: false
schema:
type: integer
type: string
format: uuid
responses:
'200':
description: Service deleted successfully
Expand Down Expand Up @@ -655,14 +668,16 @@ components:
team_ids:
type: array
items:
type: integer
type: string
format: uuid
example: 1
description: Unique identifier for the result entry
UserResponse:
type: object
properties:
id:
type: integer
type: string
format: uuid
description: The unique identifier for the user
display_name:
type: string
Expand Down Expand Up @@ -711,7 +726,8 @@ components:
type: object
properties:
id:
type: integer
type: string
format: uuid
description: Unique identifier for the game
start_time:
type: string
Expand Down Expand Up @@ -756,7 +772,8 @@ components:
type: object
properties:
id:
type: integer
type: string
format: uuid
description: Unique identifier for the result entry
team_id:
type: string
Expand Down Expand Up @@ -801,7 +818,8 @@ components:
type: object
properties:
id:
type: integer
type: string
format: uuid
description: Unique identifier for the service
name:
type: string
Expand Down Expand Up @@ -846,7 +864,8 @@ components:
type: object
properties:
id:
type: integer
type: string
format: uuid
description: Unique identifier for the team
name:
type: string
Expand All @@ -870,7 +889,8 @@ components:
- name
properties:
id:
type: integer
type: string
format: uuid
description: The unique identifier of the university
example: 1
name:
Expand Down
1 change: 1 addition & 0 deletions internal/app/database/struct_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func RegisterAllUpdates() map[string][]DatabaseUpdateFunc {
allUpdates = RegisterDatabaseUpdate(allUpdates, DatabaseUpdate_update0012_update0012testdata)
allUpdates = RegisterDatabaseUpdate(allUpdates, DatabaseUpdate_update0012_update0013)
allUpdates = RegisterDatabaseUpdate(allUpdates, DatabaseUpdate_update0013_update0013testdata)
allUpdates = RegisterDatabaseUpdate(allUpdates, DatabaseUpdate_update0013_update0014)
return allUpdates
}

Expand Down
Loading

0 comments on commit 3f9e465

Please sign in to comment.