Skip to content

Commit

Permalink
Merge pull request #19 from isd-sgcu/fix/updatepet
Browse files Browse the repository at this point in the history
Fix/updatepet
  • Loading branch information
bookpanda authored Jan 13, 2024
2 parents 90c7017 + f047c7f commit 42aa62a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 29 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 0 additions & 2 deletions src/app/model/pet/pet.model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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"`
Expand Down
4 changes: 0 additions & 4 deletions src/app/service/pet/pet.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
22 changes: 0 additions & 22 deletions src/app/service/pet/pet.service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
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 Down Expand Up @@ -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),
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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),
Expand All @@ -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,
Expand All @@ -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),
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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)],
Expand All @@ -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(),
Expand All @@ -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),
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 42aa62a

Please sign in to comment.