Skip to content

Commit

Permalink
refactor: group together group-roles and group routes (tested in swag…
Browse files Browse the repository at this point in the history
…ger + test.go files passing)

BREAKING CHANGE:
  • Loading branch information
wyattchris committed Feb 15, 2024
1 parent 63e18c4 commit 862935c
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 190 deletions.
124 changes: 62 additions & 62 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,59 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/care-groups/:groupName": {
"/files/upload": {
"post": {
"description": "Creates a new care group with the provided group name.",
"description": "Upload a file to database and S3 bucket",
"tags": [
"groups"
"file"
],
"summary": "Upload a file",
"parameters": [
{
"type": "file",
"description": "Body with file zip",
"name": "file_data",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "The userId of the uploader",
"name": "upload_by",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "The groupId of the uploader",
"name": "group_id",
"in": "formData",
"required": true
}
],
"summary": "Creates a care group",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.CareGroup"
}
"$ref": "#/definitions/models.File"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/care-groups/addUser/:userId/:groupId/:role": {
"/group/:groupName": {
"post": {
"description": "Adds a user to a care group given a userID, groupID, and role",
"description": "Creates a new care group with the provided group name.",
"tags": [
"groups"
],
"summary": "Adds a user to a care group",
"summary": "Creates a care group",
"responses": {
"200": {
"description": "OK",
Expand All @@ -51,39 +77,24 @@ const docTemplate = `{
"$ref": "#/definitions/models.CareGroup"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
}
}
}
},
"/care-groups/{groupid}/member": {
"get": {
"description": "retrieve all users in given group id",
"/group/addUser/:userId/:groupId/:role": {
"post": {
"description": "Adds a user to a care group given a userID, groupID, and role",
"tags": [
"groups"
],
"summary": "Get all members from a group",
"parameters": [
{
"type": "string",
"description": "group id",
"name": "groupid",
"in": "path",
"required": true
}
],
"summary": "Adds a user to a care group",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
"$ref": "#/definitions/models.CareGroup"
}
}
},
Expand All @@ -96,41 +107,27 @@ const docTemplate = `{
}
}
},
"/files/upload": {
"post": {
"description": "Upload a file to database and S3 bucket",
"/group/member/{uid}": {
"get": {
"description": "get the group id from the user id",
"tags": [
"file"
"group"
],
"summary": "Upload a file",
"summary": "Retrieve a group id given a user id",
"parameters": [
{
"type": "file",
"description": "Body with file zip",
"name": "file_data",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "The userId of the uploader",
"name": "upload_by",
"in": "formData",
"required": true
},
{
"type": "integer",
"description": "The groupId of the uploader",
"name": "group_id",
"in": "formData",
"description": "user id",
"name": "uid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.File"
"type": "string"
}
},
"400": {
Expand All @@ -142,7 +139,7 @@ const docTemplate = `{
}
}
},
"/group-roles": {
"/group/roles": {
"get": {
"description": "get all group roles from the db",
"tags": [
Expand All @@ -162,18 +159,18 @@ const docTemplate = `{
}
}
},
"/group-roles/get-group/{uid}": {
"/group/{groupId}": {
"get": {
"description": "get the group id from the user id",
"description": "retrieve all users in given group id",
"tags": [
"group"
"groups"
],
"summary": "Retrieve a group id given a user id",
"summary": "Get all members from a group",
"parameters": [
{
"type": "string",
"description": "user id",
"name": "uid",
"description": "group id",
"name": "groupId",
"in": "path",
"required": true
}
Expand All @@ -182,7 +179,10 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"type": "string"
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
Expand Down
Loading

0 comments on commit 862935c

Please sign in to comment.