Skip to content

Commit

Permalink
fix: visivle not required, adopt remove pet_id body
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Feb 17, 2024
1 parent 11d4613 commit 7164624
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/app/dto/pet.dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type CreatePetRequest struct {
}

type ChangeViewPetRequest struct {
Visible bool `json:"visible" validate:"required"`
Visible bool `json:"visible"`
}

type ChangeViewPetResponse struct {
Expand All @@ -81,7 +81,6 @@ type ChangeViewPetResponse struct {

type AdoptByRequest struct {
UserID string `json:"user_id" validate:"required"`
PetID string `json:"pet_id" validate:"required"`
}

type AdoptByResponse struct {
Expand Down
2 changes: 1 addition & 1 deletion src/app/service/pet/pet.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (s *Service) Adopt(petId string, in *dto.AdoptByRequest) (result *dto.Adopt

res, errRes := s.petClient.AdoptPet(ctx, &petproto.AdoptPetRequest{
UserId: in.UserID,
PetId: in.PetID,
PetId: petId,
})
if errRes != nil {
st, _ := status.FromError(errRes)
Expand Down
1 change: 0 additions & 1 deletion src/app/service/pet/pet.service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ func (t *PetServiceTest) SetupTest() {

t.AdoptDto = &dto.AdoptByRequest{
UserID: t.Pet.AdoptBy,
PetID: t.Pet.Id,
}

t.FindAllImageReq = &imgproto.FindAllImageRequest{}
Expand Down
10 changes: 3 additions & 7 deletions src/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,13 +951,9 @@ const docTemplate = `{
"dto.AdoptByRequest": {
"type": "object",
"required": [
"pet_id",
"user_id"
],
"properties": {
"pet_id": {
"type": "string"
},
"user_id": {
"type": "string"
}
Expand Down Expand Up @@ -985,9 +981,6 @@ const docTemplate = `{
},
"dto.ChangeViewPetRequest": {
"type": "object",
"required": [
"visible"
],
"properties": {
"visible": {
"type": "boolean"
Expand Down Expand Up @@ -1146,6 +1139,9 @@ const docTemplate = `{
"object_key": {
"type": "string"
},
"pet_id": {
"type": "string"
},
"url": {
"type": "string"
}
Expand Down
10 changes: 3 additions & 7 deletions src/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -947,13 +947,9 @@
"dto.AdoptByRequest": {
"type": "object",
"required": [
"pet_id",
"user_id"
],
"properties": {
"pet_id": {
"type": "string"
},
"user_id": {
"type": "string"
}
Expand Down Expand Up @@ -981,9 +977,6 @@
},
"dto.ChangeViewPetRequest": {
"type": "object",
"required": [
"visible"
],
"properties": {
"visible": {
"type": "boolean"
Expand Down Expand Up @@ -1142,6 +1135,9 @@
"object_key": {
"type": "string"
},
"pet_id": {
"type": "string"
},
"url": {
"type": "string"
}
Expand Down
7 changes: 2 additions & 5 deletions src/docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
definitions:
dto.AdoptByRequest:
properties:
pet_id:
type: string
user_id:
type: string
required:
- pet_id
- user_id
type: object
dto.AdoptByResponse:
Expand All @@ -26,8 +23,6 @@ definitions:
properties:
visible:
type: boolean
required:
- visible
type: object
dto.ChangeViewPetResponse:
properties:
Expand Down Expand Up @@ -130,6 +125,8 @@ definitions:
type: string
object_key:
type: string
pet_id:
type: string
url:
type: string
type: object
Expand Down

0 comments on commit 7164624

Please sign in to comment.