Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gear/joh 28 pet and like endpoints #14

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from

Conversation

macgeargear
Copy link
Contributor

  1. fix problem about cannot send request for change boolean value from true to false
  • solve by create change bool to *bool and create function BoolAddr that return address of boolean value
  1. add codes.InvalidArgument for DtoToRaw and RawToDto error
  2. comment image service code out for test grpc call

Copy link

linear bot commented Jan 3, 2024

JOH-28 Pet and Like endpoints

FindAll - GET /pet

FindOne - GET /pet/:id

Create- POST /pet/create

FindByUserId - GET /like

Copy link
Contributor

@bookpanda bookpanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. iirc pet methods now return
Image structs instead of image urls. Also, please try updating protofiles

Comment on lines +18 to +21
IsSterile *bool `json:"is_sterile"`
IsVaccinated *bool `json:"is_vaccine"`
IsVisible *bool `json:"is_visible"`
IsClubPet *bool `json:"is_club_pet"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should discuss about the best method we can avoid "update non-zero fields."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from gorm documentation I see 3 solutions they suggested.

  1. update only one column
  2. use map[string]interface{} instead of struct
  3. do select before update

ref

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my experience, I preferred the third option because it's very easy to implement it along fieldmask

// Update Pet

message UpdatePetRequest{
  Pet Pet = 1;
  google.protobuf.FieldMask field_mask = 2;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to state your opinion here, you won't be judged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for sharing your insights and great options, i'll take a look

src/app/service/pet/pet.service.go Outdated Show resolved Hide resolved
src/app/service/pet/pet.service.go Outdated Show resolved Hide resolved
src/app/service/pet/pet.service.go Outdated Show resolved Hide resolved
src/app/service/pet/pet.service.go Outdated Show resolved Hide resolved
src/app/service/pet/pet.service.go Outdated Show resolved Hide resolved
src/app/service/pet/pet.service.go Outdated Show resolved Hide resolved
src/app/service/pet/pet.service.go Outdated Show resolved Hide resolved
Copy link
Contributor

@bookpanda bookpanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you fixed the boolean problem, or is it going to be a later incremental change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants