Skip to content

Commit

Permalink
Merge pull request #23 from isd-sgcu/fix/newpet
Browse files Browse the repository at this point in the history
Fix/newpet
  • Loading branch information
bookpanda authored Jan 13, 2024
2 parents ee1704b + 1b79539 commit 55c5bbe
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/gofiber/fiber/v2 v2.52.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.5.0
github.com/isd-sgcu/johnjud-go-proto v0.3.1
github.com/isd-sgcu/johnjud-go-proto v0.5.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.31.0
github.com/spf13/viper v1.18.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ github.com/isd-sgcu/johnjud-go-proto v0.2.2 h1:TOAmbwy/I+8/J5LPZH0ZN7lSLczBiZe1f
github.com/isd-sgcu/johnjud-go-proto v0.2.2/go.mod h1:1OK6aiCgtXQiLhxp0r6iLEejYIRpckWQZDrCZ9Trbo4=
github.com/isd-sgcu/johnjud-go-proto v0.3.1 h1:WyWfzl+5nWOw3AmINtcTfojg4CJh8ZRNbZC6qA//OXU=
github.com/isd-sgcu/johnjud-go-proto v0.3.1/go.mod h1:1OK6aiCgtXQiLhxp0r6iLEejYIRpckWQZDrCZ9Trbo4=
github.com/isd-sgcu/johnjud-go-proto v0.5.0 h1:GgqRzWjya5p1yhfU/kpX8i4WL42+qT2TkyXZmssH6B4=
github.com/isd-sgcu/johnjud-go-proto v0.5.0/go.mod h1:1OK6aiCgtXQiLhxp0r6iLEejYIRpckWQZDrCZ9Trbo4=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
Expand Down
6 changes: 0 additions & 6 deletions src/app/dto/pet.dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
type PetResponse struct {
Id string `json:"id"`
Type string `json:"type"`
Species string `json:"species"`
Name string `json:"name"`
Birthdate string `json:"birthdate"`
Gender pet.Gender `json:"gender"`
Expand All @@ -19,7 +18,6 @@ type PetResponse struct {
IsSterile *bool `json:"is_sterile"`
IsVaccinated *bool `json:"is_vaccinated"`
IsVisible *bool `json:"is_visible"`
IsClubPet *bool `json:"is_club_pet"`
Origin string `json:"origin"`
Address string `json:"address"`
Contact string `json:"contact"`
Expand All @@ -29,7 +27,6 @@ type PetResponse struct {

type CreatePetRequest struct {
Type string `json:"type" validate:"required"`
Species string `json:"species" validate:"required"`
Name string `json:"name" validate:"required"`
Birthdate string `json:"birthdate" validate:"required"`
Gender pet.Gender `json:"gender" validate:"required" example:"male"`
Expand All @@ -41,7 +38,6 @@ type CreatePetRequest struct {
IsSterile *bool `json:"is_sterile" validate:"required"`
IsVaccinated *bool `json:"is_vaccinated" validate:"required"`
IsVisible *bool `json:"is_visible" validate:"required"`
IsClubPet *bool `json:"is_club_pet" validate:"required"`
Origin string `json:"origin" validate:"required"`
Address string `json:"address"`
Contact string `json:"contact"`
Expand All @@ -68,7 +64,6 @@ type AdoptByResponse struct {

type UpdatePetRequest struct {
Type string `json:"type"`
Species string `json:"species"`
Name string `json:"name"`
Birthdate string `json:"birthdate"`
Gender pet.Gender `json:"gender"`
Expand All @@ -80,7 +75,6 @@ type UpdatePetRequest struct {
IsSterile *bool `json:"is_sterile"`
IsVaccinated *bool `json:"is_vaccinated"`
IsVisible *bool `json:"is_visible"`
IsClubPet *bool `json:"is_club_pet"`
Origin string `json:"origin"`
Address string `json:"address"`
Contact string `json:"contact"`
Expand Down
4 changes: 0 additions & 4 deletions src/app/handler/pet/pet.handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func (t *PetHandlerTest) SetupTest() {
pet := &petProto.Pet{
Id: faker.UUIDDigit(),
Type: faker.Word(),
Species: faker.Word(),
Name: faker.Name(),
Birthdate: faker.Word(),
Gender: string(genders[rand.Intn(2)]),
Expand All @@ -69,7 +68,6 @@ func (t *PetHandlerTest) SetupTest() {
IsSterile: true,
IsVaccinated: true,
IsVisible: true,
IsClubPet: true,
Origin: faker.Paragraph(),
Address: faker.Paragraph(),
Contact: faker.Paragraph(),
Expand All @@ -85,7 +83,6 @@ func (t *PetHandlerTest) SetupTest() {
t.PetDto = &dto.PetResponse{
Id: t.Pet.Id,
Type: t.Pet.Type,
Species: t.Pet.Species,
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: pet.Gender(t.Pet.Gender),
Expand All @@ -97,7 +94,6 @@ func (t *PetHandlerTest) SetupTest() {
IsSterile: &t.Pet.IsSterile,
IsVaccinated: &t.Pet.IsVaccinated,
IsVisible: &t.Pet.IsVisible,
IsClubPet: &t.Pet.IsClubPet,
Origin: t.Pet.Origin,
Address: t.Pet.Address,
Contact: t.Pet.Contact,
Expand Down
8 changes: 0 additions & 8 deletions src/app/service/pet/pet.service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func (t *PetServiceTest) SetupTest() {
pet := &petproto.Pet{
Id: faker.UUIDDigit(),
Type: faker.Word(),
Species: faker.Word(),
Name: faker.Name(),
Birthdate: faker.Word(),
Gender: string(genders[rand.Intn(2)]),
Expand All @@ -72,7 +71,6 @@ func (t *PetServiceTest) SetupTest() {
IsSterile: true,
IsVaccinated: true,
IsVisible: true,
IsClubPet: true,
Origin: faker.Paragraph(),
Address: faker.Paragraph(),
Contact: faker.Paragraph(),
Expand All @@ -88,7 +86,6 @@ func (t *PetServiceTest) SetupTest() {
t.PetNotVisible = &petproto.Pet{
Id: t.Pet.Id,
Type: t.Pet.Type,
Species: t.Pet.Species,
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: t.Pet.Gender,
Expand All @@ -101,7 +98,6 @@ func (t *PetServiceTest) SetupTest() {
IsSterile: t.Pet.IsSterile,
IsVaccinated: t.Pet.IsVaccinated,
IsVisible: false,
IsClubPet: t.Pet.IsClubPet,
Origin: t.Pet.Origin,
Address: t.Pet.Address,
Contact: t.Pet.Contact,
Expand All @@ -112,7 +108,6 @@ func (t *PetServiceTest) SetupTest() {

t.CreatePetDto = &dto.CreatePetRequest{
Type: t.Pet.Type,
Species: t.Pet.Species,
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: pet.Gender(t.Pet.Gender),
Expand All @@ -125,7 +120,6 @@ func (t *PetServiceTest) SetupTest() {
IsSterile: &t.Pet.IsSterile,
IsVaccinated: &t.Pet.IsVaccinated,
IsVisible: &t.Pet.IsVisible,
IsClubPet: &t.Pet.IsClubPet,
Origin: t.Pet.Origin,
Address: t.Pet.Address,
Contact: t.Pet.Contact,
Expand All @@ -134,7 +128,6 @@ func (t *PetServiceTest) SetupTest() {

t.UpdatePetDto = &dto.UpdatePetRequest{
Type: t.Pet.Type,
Species: t.Pet.Species,
Name: t.Pet.Name,
Birthdate: t.Pet.Birthdate,
Gender: pet.Gender(t.Pet.Gender),
Expand All @@ -147,7 +140,6 @@ func (t *PetServiceTest) SetupTest() {
IsSterile: &t.Pet.IsSterile,
IsVaccinated: &t.Pet.IsVaccinated,
IsVisible: &t.Pet.IsVisible,
IsClubPet: &t.Pet.IsClubPet,
Origin: t.Pet.Origin,
Address: t.Pet.Address,
Contact: t.Pet.Contact,
Expand Down
7 changes: 0 additions & 7 deletions src/app/utils/pet/pet.utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func ProtoToDto(in *petproto.Pet, images []*imgproto.Image) *dto.PetResponse {
pet := &dto.PetResponse{
Id: in.Id,
Type: in.Type,
Species: in.Species,
Name: in.Name,
Birthdate: in.Birthdate,
Gender: pet.Gender(in.Gender),
Expand All @@ -43,7 +42,6 @@ func ProtoToDto(in *petproto.Pet, images []*imgproto.Image) *dto.PetResponse {
IsSterile: &in.IsSterile,
IsVaccinated: &in.IsVaccinated,
IsVisible: &in.IsVisible,
IsClubPet: &in.IsClubPet,
Origin: in.Origin,
Address: in.Address,
Contact: in.Contact,
Expand All @@ -57,7 +55,6 @@ func CreateDtoToProto(in *dto.CreatePetRequest) *petproto.CreatePetRequest {
return &petproto.CreatePetRequest{
Pet: &petproto.Pet{
Type: in.Type,
Species: in.Species,
Name: in.Name,
Birthdate: in.Birthdate,
Gender: string(in.Gender),
Expand All @@ -70,7 +67,6 @@ func CreateDtoToProto(in *dto.CreatePetRequest) *petproto.CreatePetRequest {
IsSterile: *in.IsSterile,
IsVaccinated: *in.IsVaccinated,
IsVisible: *in.IsVisible,
IsClubPet: *in.IsClubPet,
Origin: in.Origin,
Address: in.Address,
Contact: in.Contact,
Expand All @@ -84,7 +80,6 @@ func UpdateDtoToProto(id string, in *dto.UpdatePetRequest) *petproto.UpdatePetRe
Pet: &petproto.Pet{
Id: id,
Type: in.Type,
Species: in.Species,
Name: in.Name,
Birthdate: in.Birthdate,
Gender: string(in.Gender),
Expand All @@ -110,7 +105,6 @@ func ProtoToDtoList(in []*petproto.Pet, imagesList [][]*imgproto.Image) []*dto.P
pet := &dto.PetResponse{
Id: p.Id,
Type: p.Type,
Species: p.Species,
Name: p.Name,
Birthdate: p.Birthdate,
Gender: pet.Gender(p.Gender),
Expand All @@ -122,7 +116,6 @@ func ProtoToDtoList(in []*petproto.Pet, imagesList [][]*imgproto.Image) []*dto.P
IsSterile: &p.IsSterile,
IsVaccinated: &p.IsVaccinated,
IsVisible: &p.IsVisible,
IsClubPet: &p.IsClubPet,
Origin: p.Origin,
Address: p.Address,
Contact: p.Contact,
Expand Down

0 comments on commit 55c5bbe

Please sign in to comment.