From 69ac220a36263a94a86f13047063d38711b51a5a Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Mon, 8 Jan 2024 00:26:05 +0700 Subject: [PATCH] chore: gen docs --- src/docs/docs.go | 593 ++++++++++++++++++++++++++++++++++++++++-- src/docs/swagger.json | 590 ++++++++++++++++++++++++++++++++++++++++- src/docs/swagger.yaml | 402 +++++++++++++++++++++++++++- 3 files changed, 1544 insertions(+), 41 deletions(-) diff --git a/src/docs/docs.go b/src/docs/docs.go index de72062..ee19d5a 100644 --- a/src/docs/docs.go +++ b/src/docs/docs.go @@ -1,5 +1,4 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -234,9 +233,9 @@ const docTemplate = `{ } } }, - "/v1/pet/": { + "/v1/pets/": { "get": { - "description": "Return the data of pets if successfully", + "description": "Returns the data of pets if successful", "consumes": [ "application/json" ], @@ -244,17 +243,103 @@ const docTemplate = `{ "application/json" ], "tags": [ - "auth" + "pet" + ], + "summary": "finds all pets", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.PetResponse" + } + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + }, + "delete": { + "description": "Returns successful status if pet is successfully deleted", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "deletes pet", + "parameters": [ + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.DeleteResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/create": { + "post": { + "description": "Returns the data of pet if successful", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" ], - "summary": "find all pets", + "summary": "creates pet", "parameters": [ { "description": "pet dto", - "name": "signup", + "name": "create", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.PetDto" + "$ref": "#/definitions/dto.CreatePetRequest" } } ], @@ -262,7 +347,7 @@ const docTemplate = `{ "201": { "description": "Created", "schema": { - "$ref": "#/definitions/dto.PetDto" + "$ref": "#/definitions/dto.PetResponse" } }, "400": { @@ -271,10 +356,229 @@ const docTemplate = `{ "$ref": "#/definitions/dto.ResponseBadRequestErr" } }, - "409": { - "description": "Duplicate email", + "500": { + "description": "Internal service error", "schema": { - "$ref": "#/definitions/dto.ResponseConflictErr" + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/{id}": { + "get": { + "description": "Returns the data of a pet if successful", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "finds one pet", + "parameters": [ + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.PetResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + }, + "put": { + "description": "Returns the data of pet if successfully", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "updates pet", + "parameters": [ + { + "description": "update pet dto", + "name": "update", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.UpdatePetRequest" + } + }, + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.PetResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/{id}/adopt": { + "put": { + "description": "Return true if the pet is successfully adopted", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "Change a pet's adoptBy status", + "parameters": [ + { + "description": "adopt pet dto", + "name": "adoptDto", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.AdoptByRequest" + } + }, + { + "type": "string", + "description": "Pet ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.AdoptByResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/{id}/visible": { + "put": { + "description": "Returns successful status if pet's IsVisible is successfully changed", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "changes pet's public visiblility", + "parameters": [ + { + "description": "changeView pet dto", + "name": "changeViewDto", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ChangeViewPetRequest" + } + }, + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.ChangeViewPetResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" } }, "500": { @@ -294,6 +598,29 @@ const docTemplate = `{ } }, "definitions": { + "dto.AdoptByRequest": { + "type": "object", + "required": [ + "pet_id", + "user_id" + ], + "properties": { + "pet_id": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.AdoptByResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + } + }, "dto.BadReqErrResponse": { "type": "object", "properties": { @@ -306,6 +633,102 @@ const docTemplate = `{ "value": {} } }, + "dto.ChangeViewPetRequest": { + "type": "object", + "required": [ + "visible" + ], + "properties": { + "visible": { + "type": "boolean" + } + } + }, + "dto.ChangeViewPetResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + } + } + }, + "dto.CreatePetRequest": { + "type": "object", + "required": [ + "birthdate", + "gender", + "habit", + "is_club_pet", + "is_sterile", + "is_vaccinated", + "is_visible", + "name", + "species", + "status", + "type" + ], + "properties": { + "address": { + "type": "string" + }, + "adopt_by": { + "type": "string" + }, + "background": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "caption": { + "type": "string" + }, + "contact": { + "type": "string" + }, + "gender": { + "type": "integer", + "example": 1 + }, + "habit": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + } + }, + "is_club_pet": { + "type": "boolean" + }, + "is_sterile": { + "type": "boolean" + }, + "is_vaccinated": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "species": { + "type": "string" + }, + "status": { + "type": "integer", + "example": 1 + }, + "type": { + "type": "string" + } + } + }, "dto.Credential": { "type": "object", "properties": { @@ -323,6 +746,90 @@ const docTemplate = `{ } } }, + "dto.DeleteResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + } + } + }, + "dto.ImageResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "dto.PetResponse": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "adopt_by": { + "type": "string" + }, + "background": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "caption": { + "type": "string" + }, + "contact": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "habit": { + "type": "string" + }, + "id": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ImageResponse" + } + }, + "is_club_pet": { + "type": "boolean" + }, + "is_sterile": { + "type": "boolean" + }, + "is_vaccinated": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "species": { + "type": "string" + }, + "status": { + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, "dto.RefreshTokenRequest": { "type": "object", "required": [ @@ -334,9 +841,6 @@ const docTemplate = `{ } } }, - "dto.PetDto": { - "type": "object" - }, "dto.ResponseBadRequestErr": { "type": "object", "properties": { @@ -492,6 +996,65 @@ const docTemplate = `{ "type": "string" } } + }, + "dto.UpdatePetRequest": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "adopt_by": { + "type": "string" + }, + "background": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "caption": { + "type": "string" + }, + "contact": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "habit": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + } + }, + "is_club_pet": { + "type": "boolean" + }, + "is_sterile": { + "type": "boolean" + }, + "is_vaccinated": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "species": { + "type": "string" + }, + "status": { + "type": "integer" + }, + "type": { + "type": "string" + } + } } }, "securityDefinitions": { diff --git a/src/docs/swagger.json b/src/docs/swagger.json index 1303f34..deaf951 100644 --- a/src/docs/swagger.json +++ b/src/docs/swagger.json @@ -229,9 +229,9 @@ } } }, - "/v1/pet/": { + "/v1/pets/": { "get": { - "description": "Return the data of pets if successfully", + "description": "Returns the data of pets if successful", "consumes": [ "application/json" ], @@ -239,17 +239,103 @@ "application/json" ], "tags": [ - "auth" + "pet" + ], + "summary": "finds all pets", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.PetResponse" + } + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + }, + "delete": { + "description": "Returns successful status if pet is successfully deleted", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "deletes pet", + "parameters": [ + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.DeleteResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/create": { + "post": { + "description": "Returns the data of pet if successful", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" ], - "summary": "find all pets", + "summary": "creates pet", "parameters": [ { "description": "pet dto", - "name": "signup", + "name": "create", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.PetDto" + "$ref": "#/definitions/dto.CreatePetRequest" } } ], @@ -257,7 +343,7 @@ "201": { "description": "Created", "schema": { - "$ref": "#/definitions/dto.PetDto" + "$ref": "#/definitions/dto.PetResponse" } }, "400": { @@ -266,10 +352,229 @@ "$ref": "#/definitions/dto.ResponseBadRequestErr" } }, - "409": { - "description": "Duplicate email", + "500": { + "description": "Internal service error", "schema": { - "$ref": "#/definitions/dto.ResponseConflictErr" + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/{id}": { + "get": { + "description": "Returns the data of a pet if successful", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "finds one pet", + "parameters": [ + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.PetResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + }, + "put": { + "description": "Returns the data of pet if successfully", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "updates pet", + "parameters": [ + { + "description": "update pet dto", + "name": "update", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.UpdatePetRequest" + } + }, + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.PetResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/{id}/adopt": { + "put": { + "description": "Return true if the pet is successfully adopted", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "Change a pet's adoptBy status", + "parameters": [ + { + "description": "adopt pet dto", + "name": "adoptDto", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.AdoptByRequest" + } + }, + { + "type": "string", + "description": "Pet ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.AdoptByResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" + } + }, + "500": { + "description": "Internal service error", + "schema": { + "$ref": "#/definitions/dto.ResponseInternalErr" + } + }, + "503": { + "description": "Service is down", + "schema": { + "$ref": "#/definitions/dto.ResponseServiceDownErr" + } + } + } + } + }, + "/v1/pets/{id}/visible": { + "put": { + "description": "Returns successful status if pet's IsVisible is successfully changed", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "pet" + ], + "summary": "changes pet's public visiblility", + "parameters": [ + { + "description": "changeView pet dto", + "name": "changeViewDto", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ChangeViewPetRequest" + } + }, + { + "type": "string", + "description": "pet id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/dto.ChangeViewPetResponse" + } + }, + "400": { + "description": "Invalid request body", + "schema": { + "$ref": "#/definitions/dto.ResponseBadRequestErr" } }, "500": { @@ -289,6 +594,29 @@ } }, "definitions": { + "dto.AdoptByRequest": { + "type": "object", + "required": [ + "pet_id", + "user_id" + ], + "properties": { + "pet_id": { + "type": "string" + }, + "user_id": { + "type": "string" + } + } + }, + "dto.AdoptByResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + } + }, "dto.BadReqErrResponse": { "type": "object", "properties": { @@ -301,6 +629,102 @@ "value": {} } }, + "dto.ChangeViewPetRequest": { + "type": "object", + "required": [ + "visible" + ], + "properties": { + "visible": { + "type": "boolean" + } + } + }, + "dto.ChangeViewPetResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + } + } + }, + "dto.CreatePetRequest": { + "type": "object", + "required": [ + "birthdate", + "gender", + "habit", + "is_club_pet", + "is_sterile", + "is_vaccinated", + "is_visible", + "name", + "species", + "status", + "type" + ], + "properties": { + "address": { + "type": "string" + }, + "adopt_by": { + "type": "string" + }, + "background": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "caption": { + "type": "string" + }, + "contact": { + "type": "string" + }, + "gender": { + "type": "integer", + "example": 1 + }, + "habit": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + } + }, + "is_club_pet": { + "type": "boolean" + }, + "is_sterile": { + "type": "boolean" + }, + "is_vaccinated": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "species": { + "type": "string" + }, + "status": { + "type": "integer", + "example": 1 + }, + "type": { + "type": "string" + } + } + }, "dto.Credential": { "type": "object", "properties": { @@ -318,6 +742,90 @@ } } }, + "dto.DeleteResponse": { + "type": "object", + "required": [ + "success" + ], + "properties": { + "success": { + "type": "boolean" + } + } + }, + "dto.ImageResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "dto.PetResponse": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "adopt_by": { + "type": "string" + }, + "background": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "caption": { + "type": "string" + }, + "contact": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "habit": { + "type": "string" + }, + "id": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ImageResponse" + } + }, + "is_club_pet": { + "type": "boolean" + }, + "is_sterile": { + "type": "boolean" + }, + "is_vaccinated": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "species": { + "type": "string" + }, + "status": { + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, "dto.RefreshTokenRequest": { "type": "object", "required": [ @@ -329,9 +837,6 @@ } } }, - "dto.PetDto": { - "type": "object" - }, "dto.ResponseBadRequestErr": { "type": "object", "properties": { @@ -487,6 +992,65 @@ "type": "string" } } + }, + "dto.UpdatePetRequest": { + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "adopt_by": { + "type": "string" + }, + "background": { + "type": "string" + }, + "birthdate": { + "type": "string" + }, + "caption": { + "type": "string" + }, + "contact": { + "type": "string" + }, + "gender": { + "type": "integer" + }, + "habit": { + "type": "string" + }, + "images": { + "type": "array", + "items": { + "type": "string" + } + }, + "is_club_pet": { + "type": "boolean" + }, + "is_sterile": { + "type": "boolean" + }, + "is_vaccinated": { + "type": "boolean" + }, + "is_visible": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "species": { + "type": "string" + }, + "status": { + "type": "integer" + }, + "type": { + "type": "string" + } + } } }, "securityDefinitions": { diff --git a/src/docs/swagger.yaml b/src/docs/swagger.yaml index b6ed6da..e585f99 100644 --- a/src/docs/swagger.yaml +++ b/src/docs/swagger.yaml @@ -1,4 +1,19 @@ definitions: + dto.AdoptByRequest: + properties: + pet_id: + type: string + user_id: + type: string + required: + - pet_id + - user_id + type: object + dto.AdoptByResponse: + properties: + success: + type: boolean + type: object dto.BadReqErrResponse: properties: failed_field: @@ -7,6 +22,73 @@ definitions: type: string value: {} type: object + dto.ChangeViewPetRequest: + properties: + visible: + type: boolean + required: + - visible + type: object + dto.ChangeViewPetResponse: + properties: + success: + type: boolean + required: + - success + type: object + dto.CreatePetRequest: + properties: + address: + type: string + adopt_by: + type: string + background: + type: string + birthdate: + type: string + caption: + type: string + contact: + type: string + gender: + example: 1 + type: integer + habit: + type: string + images: + items: + type: string + type: array + is_club_pet: + type: boolean + is_sterile: + type: boolean + is_vaccinated: + type: boolean + is_visible: + type: boolean + name: + type: string + species: + type: string + status: + example: 1 + type: integer + type: + type: string + required: + - birthdate + - gender + - habit + - is_club_pet + - is_sterile + - is_vaccinated + - is_visible + - name + - species + - status + - type + type: object dto.Credential: properties: access_token: @@ -19,6 +101,61 @@ definitions: example: e7e84d54-7518-4... type: string type: object + dto.DeleteResponse: + properties: + success: + type: boolean + required: + - success + type: object + dto.ImageResponse: + properties: + id: + type: string + url: + type: string + type: object + dto.PetResponse: + properties: + address: + type: string + adopt_by: + type: string + background: + type: string + birthdate: + type: string + caption: + type: string + contact: + type: string + gender: + type: integer + habit: + type: string + id: + type: string + images: + items: + $ref: '#/definitions/dto.ImageResponse' + type: array + is_club_pet: + type: boolean + is_sterile: + type: boolean + is_vaccinated: + type: boolean + is_visible: + type: boolean + name: + type: string + species: + type: string + status: + type: integer + type: + type: string + type: object dto.RefreshTokenRequest: properties: refresh_token: @@ -26,8 +163,6 @@ definitions: required: - refresh_token type: object - dto.PetDto: - type: object dto.ResponseBadRequestErr: properties: data: @@ -137,6 +272,45 @@ definitions: lastname: type: string type: object + dto.UpdatePetRequest: + properties: + address: + type: string + adopt_by: + type: string + background: + type: string + birthdate: + type: string + caption: + type: string + contact: + type: string + gender: + type: integer + habit: + type: string + images: + items: + type: string + type: array + is_club_pet: + type: boolean + is_sterile: + type: boolean + is_vaccinated: + type: boolean + is_visible: + type: boolean + name: + type: string + species: + type: string + status: + type: integer + type: + type: string + type: object info: contact: email: sd.team.sgcu@gmail.com @@ -287,33 +461,162 @@ paths: summary: Signup user tags: - auth - /v1/pet/: + /v1/pets/: + delete: + consumes: + - application/json + description: Returns successful status if pet is successfully deleted + parameters: + - description: pet id + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/dto.DeleteResponse' + "400": + description: Invalid request body + schema: + $ref: '#/definitions/dto.ResponseBadRequestErr' + "500": + description: Internal service error + schema: + $ref: '#/definitions/dto.ResponseInternalErr' + "503": + description: Service is down + schema: + $ref: '#/definitions/dto.ResponseServiceDownErr' + summary: deletes pet + tags: + - pet get: consumes: - application/json - description: Return the data of pets if successfully + description: Returns the data of pets if successful + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/dto.PetResponse' + type: array + "500": + description: Internal service error + schema: + $ref: '#/definitions/dto.ResponseInternalErr' + "503": + description: Service is down + schema: + $ref: '#/definitions/dto.ResponseServiceDownErr' + summary: finds all pets + tags: + - pet + /v1/pets/{id}: + get: + consumes: + - application/json + description: Returns the data of a pet if successful parameters: - - description: pet dto + - description: pet id + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/dto.PetResponse' + "400": + description: Invalid request body + schema: + $ref: '#/definitions/dto.ResponseBadRequestErr' + "500": + description: Internal service error + schema: + $ref: '#/definitions/dto.ResponseInternalErr' + "503": + description: Service is down + schema: + $ref: '#/definitions/dto.ResponseServiceDownErr' + summary: finds one pet + tags: + - pet + put: + consumes: + - application/json + description: Returns the data of pet if successfully + parameters: + - description: update pet dto in: body - name: signup + name: update required: true schema: - $ref: '#/definitions/dto.PetDto' + $ref: '#/definitions/dto.UpdatePetRequest' + - description: pet id + in: path + name: id + required: true + type: string produces: - application/json responses: "201": description: Created schema: - $ref: '#/definitions/dto.PetDto' + $ref: '#/definitions/dto.PetResponse' "400": description: Invalid request body schema: $ref: '#/definitions/dto.ResponseBadRequestErr' - "409": - description: Duplicate email + "500": + description: Internal service error schema: - $ref: '#/definitions/dto.ResponseConflictErr' + $ref: '#/definitions/dto.ResponseInternalErr' + "503": + description: Service is down + schema: + $ref: '#/definitions/dto.ResponseServiceDownErr' + summary: updates pet + tags: + - pet + /v1/pets/{id}/adopt: + put: + consumes: + - application/json + description: Return true if the pet is successfully adopted + parameters: + - description: adopt pet dto + in: body + name: adoptDto + required: true + schema: + $ref: '#/definitions/dto.AdoptByRequest' + - description: Pet ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/dto.AdoptByResponse' + "400": + description: Invalid request body + schema: + $ref: '#/definitions/dto.ResponseBadRequestErr' "500": description: Internal service error schema: @@ -322,9 +625,82 @@ paths: description: Service is down schema: $ref: '#/definitions/dto.ResponseServiceDownErr' - summary: find all pets + summary: Change a pet's adoptBy status tags: - - auth + - pet + /v1/pets/{id}/visible: + put: + consumes: + - application/json + description: Returns successful status if pet's IsVisible is successfully changed + parameters: + - description: changeView pet dto + in: body + name: changeViewDto + required: true + schema: + $ref: '#/definitions/dto.ChangeViewPetRequest' + - description: pet id + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/dto.ChangeViewPetResponse' + "400": + description: Invalid request body + schema: + $ref: '#/definitions/dto.ResponseBadRequestErr' + "500": + description: Internal service error + schema: + $ref: '#/definitions/dto.ResponseInternalErr' + "503": + description: Service is down + schema: + $ref: '#/definitions/dto.ResponseServiceDownErr' + summary: changes pet's public visiblility + tags: + - pet + /v1/pets/create: + post: + consumes: + - application/json + description: Returns the data of pet if successful + parameters: + - description: pet dto + in: body + name: create + required: true + schema: + $ref: '#/definitions/dto.CreatePetRequest' + produces: + - application/json + responses: + "201": + description: Created + schema: + $ref: '#/definitions/dto.PetResponse' + "400": + description: Invalid request body + schema: + $ref: '#/definitions/dto.ResponseBadRequestErr' + "500": + description: Internal service error + schema: + $ref: '#/definitions/dto.ResponseInternalErr' + "503": + description: Service is down + schema: + $ref: '#/definitions/dto.ResponseServiceDownErr' + summary: creates pet + tags: + - pet schemes: - https - http