From 206a6731750b8d72eeedac5369cd78800e9e8f54 Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Sat, 13 Jan 2024 14:17:15 +0700 Subject: [PATCH 1/2] chore: update proto --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 80b2093..6b1437b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.21.5 require ( github.com/bxcodec/faker/v3 v3.8.1 github.com/google/uuid v1.5.0 - github.com/isd-sgcu/johnjud-go-proto v0.3.0 + 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 diff --git a/go.sum b/go.sum index 7c1b4df..cf9a865 100644 --- a/go.sum +++ b/go.sum @@ -22,6 +22,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/isd-sgcu/johnjud-go-proto v0.3.0 h1:UsAf2l06VypAp8nC5Ksru1QeoYwRjjxP/WKJwNOm1iY= github.com/isd-sgcu/johnjud-go-proto v0.3.0/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/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= From f047c7fa020371375f8da06b939bedd87fe1b811 Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Sat, 13 Jan 2024 14:17:27 +0700 Subject: [PATCH 2/2] fix: pet remove species, isclubpet --- src/app/model/pet/pet.model.go | 2 -- src/app/service/pet/pet.service.go | 4 ---- src/app/service/pet/pet.service_test.go | 22 ---------------------- 3 files changed, 28 deletions(-) diff --git a/src/app/model/pet/pet.model.go b/src/app/model/pet/pet.model.go index 3b780cb..ceff18a 100644 --- a/src/app/model/pet/pet.model.go +++ b/src/app/model/pet/pet.model.go @@ -8,7 +8,6 @@ import ( type Pet struct { model.Base Type string `json:"type" gorm:"tinytext"` - Species string `json:"species" gorm:"tinytext"` Name string `json:"name" gorm:"tinytext"` Birthdate string `json:"birthdate" gorm:"tinytext"` Gender pet.Gender `json:"gender" gorm:"tinytext" example:"male"` @@ -20,7 +19,6 @@ type Pet struct { IsSterile bool `json:"is_sterile"` IsVaccinated bool `json:"is_vaccine"` IsVisible bool `json:"is_visible"` - IsClubPet bool `json:"is_club_pet"` Origin string `json:"origin" gorm:"tinytext"` Address string `json:"address" gorm:"tinytext"` Contact string `json:"contact" gorm:"tinytext"` diff --git a/src/app/service/pet/pet.service.go b/src/app/service/pet/pet.service.go index 7317841..2d76c38 100644 --- a/src/app/service/pet/pet.service.go +++ b/src/app/service/pet/pet.service.go @@ -184,7 +184,6 @@ func RawToDto(in *pet.Pet, images []*image_proto.Image) *proto.Pet { return &proto.Pet{ Id: in.ID.String(), Type: in.Type, - Species: in.Species, Name: in.Name, Birthdate: in.Birthdate, Gender: string(in.Gender), @@ -197,7 +196,6 @@ func RawToDto(in *pet.Pet, images []*image_proto.Image) *proto.Pet { IsSterile: in.IsSterile, IsVaccinated: in.IsVaccinated, IsVisible: in.IsVisible, - IsClubPet: in.IsClubPet, Origin: in.Origin, Address: in.Address, Contact: in.Contact, @@ -239,7 +237,6 @@ func DtoToRaw(in *proto.Pet) (res *pet.Pet, err error) { DeletedAt: gorm.DeletedAt{}, }, Type: in.Type, - Species: in.Species, Name: in.Name, Birthdate: in.Birthdate, Gender: gender, @@ -251,7 +248,6 @@ func DtoToRaw(in *proto.Pet) (res *pet.Pet, err error) { IsSterile: in.IsSterile, IsVaccinated: in.IsVaccinated, IsVisible: in.IsVisible, - IsClubPet: in.IsClubPet, Origin: in.Origin, Address: in.Address, Contact: in.Contact, diff --git a/src/app/service/pet/pet.service_test.go b/src/app/service/pet/pet.service_test.go index a2167b9..f13fabc 100644 --- a/src/app/service/pet/pet.service_test.go +++ b/src/app/service/pet/pet.service_test.go @@ -60,7 +60,6 @@ func (t *PetServiceTest) SetupTest() { DeletedAt: gorm.DeletedAt{}, }, Type: faker.Word(), - Species: faker.Word(), Name: faker.Name(), Birthdate: faker.Word(), Gender: genders[rand.Intn(2)], @@ -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(), @@ -100,7 +98,6 @@ func (t *PetServiceTest) SetupTest() { t.PetDto = &proto.Pet{ Id: t.Pet.ID.String(), Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: string(t.Pet.Gender), @@ -112,7 +109,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, @@ -127,7 +123,6 @@ func (t *PetServiceTest) SetupTest() { DeletedAt: t.Pet.Base.DeletedAt, }, Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: t.Pet.Gender, @@ -139,7 +134,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, @@ -153,7 +147,6 @@ func (t *PetServiceTest) SetupTest() { DeletedAt: t.Pet.Base.DeletedAt, }, Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: t.Pet.Gender, @@ -165,7 +158,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, @@ -174,7 +166,6 @@ func (t *PetServiceTest) SetupTest() { t.CreatePetReqMock = &proto.CreatePetRequest{ Pet: &proto.Pet{ Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: string(t.Pet.Gender), @@ -187,7 +178,6 @@ func (t *PetServiceTest) SetupTest() { IsSterile: t.Pet.IsSterile, IsVaccinated: t.Pet.IsVaccinated, IsVisible: t.Pet.IsVaccinated, - IsClubPet: t.Pet.IsClubPet, Origin: t.Pet.Origin, Address: t.Pet.Address, Contact: t.Pet.Contact, @@ -198,7 +188,6 @@ func (t *PetServiceTest) SetupTest() { Pet: &proto.Pet{ Id: t.Pet.ID.String(), Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: string(t.Pet.Gender), @@ -211,7 +200,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, @@ -231,7 +219,6 @@ func (t *PetServiceTest) SetupTest() { DeletedAt: t.Pet.Base.DeletedAt, }, Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: t.Pet.Gender, @@ -243,7 +230,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, @@ -378,7 +364,6 @@ func createPets() []*pet.Pet { DeletedAt: gorm.DeletedAt{}, }, Type: faker.Word(), - Species: faker.Word(), Name: faker.Name(), Birthdate: faker.Word(), Gender: genders[rand.Intn(2)], @@ -390,7 +375,6 @@ func createPets() []*pet.Pet { IsSterile: true, IsVaccinated: true, IsVisible: true, - IsClubPet: true, Origin: faker.Paragraph(), Address: faker.Paragraph(), Contact: faker.Paragraph(), @@ -408,7 +392,6 @@ func (t *PetServiceTest) createPetsDto(in []*pet.Pet, imagesList [][]*img_proto. r := &proto.Pet{ Id: p.ID.String(), Type: p.Type, - Species: p.Species, Name: p.Name, Birthdate: p.Birthdate, Gender: string(p.Gender), @@ -421,7 +404,6 @@ func (t *PetServiceTest) createPetsDto(in []*pet.Pet, imagesList [][]*img_proto. IsSterile: p.IsSterile, IsVaccinated: p.IsVaccinated, IsVisible: p.IsVisible, - IsClubPet: p.IsClubPet, Origin: p.Origin, Address: p.Address, Contact: p.Contact, @@ -441,7 +423,6 @@ func (t *PetServiceTest) TestCreateSuccess() { in := &pet.Pet{ Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: t.Pet.Gender, @@ -453,7 +434,6 @@ func (t *PetServiceTest) TestCreateSuccess() { 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, @@ -475,7 +455,6 @@ func (t *PetServiceTest) TestCreateInternalErr() { in := &pet.Pet{ Type: t.Pet.Type, - Species: t.Pet.Species, Name: t.Pet.Name, Birthdate: t.Pet.Birthdate, Gender: t.Pet.Gender, @@ -487,7 +466,6 @@ func (t *PetServiceTest) TestCreateInternalErr() { 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,