Skip to content

Commit 60eab02

Browse files
Merge pull request #55 from dscsnu/leaveteam
Leaveteam
2 parents 4f036d7 + 7deeb0f commit 60eab02

File tree

7 files changed

+377
-182
lines changed

7 files changed

+377
-182
lines changed

backend/docs/docs.go

Lines changed: 106 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,79 @@ const docTemplate = `{
1515
"host": "{{.Host}}",
1616
"basePath": "{{.BasePath}}",
1717
"paths": {
18-
"/api/createteam": {
19-
"post": {
20-
"security": [
21-
{
22-
"BearerAuth": []
23-
}
24-
],
25-
"description": "Creates a new team using the provided team name and returns the generated team ID. Also assigns default levels and initializes a communication channel.",
18+
"/api/game": {
19+
"get": {
20+
"description": "Gets the config data for the game",
2621
"consumes": [
2722
"application/json"
2823
],
2924
"produces": [
3025
"application/json"
3126
],
3227
"tags": [
33-
"Team"
28+
"Game"
3429
],
35-
"summary": "Create Team",
36-
"parameters": [
37-
{
38-
"description": "Payload containing the team name",
39-
"name": "body",
40-
"in": "body",
41-
"required": true,
30+
"summary": "Get GameConfig",
31+
"responses": {
32+
"200": {
33+
"description": "Game config retrieved successfully",
34+
"schema": {
35+
"type": "object",
36+
"additionalProperties": {
37+
"type": "string"
38+
}
39+
}
40+
},
41+
"500": {
42+
"description": "Internal server error",
4243
"schema": {
4344
"type": "object",
4445
"properties": {
45-
"team_name": {
46+
"error": {
4647
"type": "string"
4748
}
4849
}
4950
}
5051
}
52+
}
53+
}
54+
},
55+
"/api/team": {
56+
"get": {
57+
"description": "Gets the team info, using either team ID or user ID",
58+
"consumes": [
59+
"application/json"
60+
],
61+
"produces": [
62+
"application/json"
63+
],
64+
"tags": [
65+
"Team"
66+
],
67+
"summary": "Get team info",
68+
"parameters": [
69+
{
70+
"type": "string",
71+
"description": "ID of the team",
72+
"name": "team_id",
73+
"in": "query"
74+
},
75+
{
76+
"type": "string",
77+
"description": "ID of a user belonging to the team",
78+
"name": "user_id",
79+
"in": "query"
80+
}
5181
],
5282
"responses": {
5383
"200": {
54-
"description": "The generated team ID",
84+
"description": "Team retrieved successfully",
5585
"schema": {
56-
"type": "object",
57-
"properties": {
58-
"team_id": {
59-
"type": "string"
60-
}
61-
}
86+
"$ref": "#/definitions/types.Team"
6287
}
6388
},
6489
"400": {
65-
"description": "Bad Request",
90+
"description": "Bad request",
6691
"schema": {
6792
"type": "object",
6893
"properties": {
@@ -73,7 +98,7 @@ const docTemplate = `{
7398
}
7499
},
75100
"500": {
76-
"description": "Internal Server Error",
101+
"description": "Internal server error",
77102
"schema": {
78103
"type": "object",
79104
"properties": {
@@ -86,31 +111,65 @@ const docTemplate = `{
86111
}
87112
}
88113
},
89-
"/api/game": {
90-
"get": {
91-
"description": "Gets the config data for the game",
114+
"/api/team/create": {
115+
"post": {
116+
"security": [
117+
{
118+
"BearerAuth": []
119+
}
120+
],
121+
"description": "Creates a new team using the provided team name and returns the generated team ID. Also assigns default levels and initializes a communication channel.",
92122
"consumes": [
93123
"application/json"
94124
],
95125
"produces": [
96126
"application/json"
97127
],
98128
"tags": [
99-
"Game"
129+
"Team"
130+
],
131+
"summary": "Create Team",
132+
"parameters": [
133+
{
134+
"description": "Payload containing the team name",
135+
"name": "body",
136+
"in": "body",
137+
"required": true,
138+
"schema": {
139+
"type": "object",
140+
"properties": {
141+
"team_name": {
142+
"type": "string"
143+
}
144+
}
145+
}
146+
}
100147
],
101-
"summary": "Get GameConfig",
102148
"responses": {
103149
"200": {
104-
"description": "Game config retrieved successfully",
150+
"description": "The generated team ID",
105151
"schema": {
106152
"type": "object",
107-
"additionalProperties": {
108-
"type": "string"
153+
"properties": {
154+
"team_id": {
155+
"type": "string"
156+
}
157+
}
158+
}
159+
},
160+
"400": {
161+
"description": "Bad Request",
162+
"schema": {
163+
"type": "object",
164+
"properties": {
165+
"error": {
166+
"type": "string"
167+
}
109168
}
110169
}
111170
},
112171
"500": {
113-
"description": "Internal server error",
172+
"description": "Internal Server Error",
114173
"schema": {
115174
"type": "object",
116175
"properties": {
@@ -123,9 +182,9 @@ const docTemplate = `{
123182
}
124183
}
125184
},
126-
"/api/tean": {
127-
"get": {
128-
"description": "Gets the team info, using either team ID or user ID",
185+
"/api/team/leave": {
186+
"post": {
187+
"description": "Removes the member sending the request from their team if they are currently in one, otherwise throws an error",
129188
"consumes": [
130189
"application/json"
131190
],
@@ -135,37 +194,20 @@ const docTemplate = `{
135194
"tags": [
136195
"Team"
137196
],
138-
"summary": "Get team info",
197+
"summary": "Leave team",
139198
"parameters": [
140199
{
141-
"type": "string",
142-
"description": "ID of the team",
143-
"name": "team_id",
144-
"in": "query"
145-
},
146-
{
147-
"type": "string",
148-
"description": "ID of a user belonging to the team",
149-
"name": "user_id",
150-
"in": "query"
200+
"description": "No payload",
201+
"name": "body",
202+
"in": "body",
203+
"required": true
151204
}
152205
],
153206
"responses": {
154207
"200": {
155-
"description": "Team retrieved successfully",
208+
"description": "No payload is returned",
156209
"schema": {
157-
"$ref": "#/definitions/types.Team"
158-
}
159-
},
160-
"400": {
161-
"description": "Bad request",
162-
"schema": {
163-
"type": "object",
164-
"properties": {
165-
"error": {
166-
"type": "string"
167-
}
168-
}
210+
"type": "nil"
169211
}
170212
},
171213
"500": {
@@ -182,7 +224,7 @@ const docTemplate = `{
182224
}
183225
}
184226
},
185-
"/api/updateteam": {
227+
"/api/team/update": {
186228
"post": {
187229
"description": "Adds members to the team specified in the payload",
188230
"consumes": [
@@ -265,7 +307,7 @@ const docTemplate = `{
265307
"schema": {
266308
"type": "object",
267309
"properties": {
268-
"is_ready": {
310+
"user_status": {
269311
"type": "boolean"
270312
}
271313
}

0 commit comments

Comments
 (0)