Skip to content

Commit

Permalink
"Change id to uuid #14"
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Polyakov committed Jun 18, 2024
1 parent bbcb04b commit bf4c47d
Show file tree
Hide file tree
Showing 21 changed files with 330 additions and 275 deletions.
96 changes: 58 additions & 38 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,21 @@ paths:
description: Bad request
'500':
description: Failed response
'/api/users/{id}':
'/api/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 @@ -163,13 +164,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 @@ -189,13 +191,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 @@ -242,20 +245,21 @@ paths:
description: Bad request
'500':
description: Failed response
'/api/games/{id}':
'/api/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 @@ -273,13 +277,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 @@ -305,13 +310,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 @@ -371,20 +377,21 @@ paths:
content:
application/json:
schema: {}
'/api/teams/{id}':
'/api/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 @@ -398,13 +405,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 @@ -420,13 +428,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 @@ -462,20 +471,21 @@ paths:
responses:
'200':
description: Result created successfully
'/api/results/{id}':
'/api/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 @@ -515,20 +525,21 @@ paths:
responses:
'200':
description: Service created successfully
'/api/services/{id}':
'/api/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 @@ -542,13 +553,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 @@ -564,13 +576,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 @@ -624,14 +637,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
user_name:
type: string
Expand Down Expand Up @@ -677,7 +692,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 @@ -722,7 +738,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 @@ -767,7 +784,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 @@ -812,7 +830,8 @@ components:
type: object
properties:
id:
type: integer
type: string
format: uuid
description: Unique identifier for the team
name:
type: string
Expand All @@ -836,7 +855,8 @@ components:
- name
properties:
id:
type: integer
type: string
format: uuid
description: The unique identifier of the university
example: 1
name:
Expand Down
10 changes: 6 additions & 4 deletions internal/app/db/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package db

import (
"time"

openapi_types "github.com/oapi-codegen/runtime/types"
)

type Game struct {
Id int `db:"id"`
StartTime time.Time `db:"start_time"`
EndTime time.Time `db:"end_time"`
Description string `db:"description"`
Id openapi_types.UUID `db:"id"`
StartTime time.Time `db:"start_time"`
EndTime time.Time `db:"end_time"`
Description string `db:"description"`
}

type GameDetails struct {
Expand Down
12 changes: 7 additions & 5 deletions internal/app/db/result.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package db

import openapi_types "github.com/oapi-codegen/runtime/types"

type Result struct {
Id int `db:"id"`
TeamId string `db:"team_id"`
GameId string `db:"game_id"`
Score int `db:"score"`
Rank int `db:"rank"`
Id openapi_types.UUID `db:"id"`
TeamId string `db:"team_id"`
GameId string `db:"game_id"`
Score int `db:"score"`
Rank int `db:"rank"`
}
14 changes: 8 additions & 6 deletions internal/app/db/service.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package db

import openapi_types "github.com/oapi-codegen/runtime/types"

type Service struct {
Id int `db:"id"`
Name string `db:"name"`
Author string `db:"author"`
LogoUrl string `db:"logo_url"`
Description string `db:"description"`
IsPublic bool `db:"is_public"`
Id openapi_types.UUID `db:"id"`
Name string `db:"name"`
Author string `db:"author"`
LogoUrl string `db:"logo_url"`
Description string `db:"description"`
IsPublic bool `db:"is_public"`
}
Loading

0 comments on commit bf4c47d

Please sign in to comment.