diff --git a/src/app/model/adopt/adopt.model.go b/src/app/model/adopt/adopt.model.go deleted file mode 100644 index 24a8a86..0000000 --- a/src/app/model/adopt/adopt.model.go +++ /dev/null @@ -1,16 +0,0 @@ -package adopt - -import ( - "github.com/google/uuid" - "github.com/isd-sgcu/johnjud-backend/src/app/model" - "github.com/isd-sgcu/johnjud-backend/src/app/model/pet" - "github.com/isd-sgcu/johnjud-backend/src/app/model/user" -) - -type Adopt struct { - model.Base - PetID *uuid.UUID `json:"pet_id" gorm:"index:idx_name,unique"` - Pet *pet.Pet `json:"pet" gorm:"foreignKey:PetID;constraint:OnUpdate:CASCADE;OnDelete:SET NULL;"` - UserID *uuid.UUID `json:"user_id" gorm:"index:idx_name,unique"` - User *user.User `json:"user" gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE;OnDelete:SET NULL;"` -} diff --git a/src/app/repository/adopt/adopt.repository.go b/src/app/repository/adopt/adopt.repository.go deleted file mode 100644 index 2acc99b..0000000 --- a/src/app/repository/adopt/adopt.repository.go +++ /dev/null @@ -1,26 +0,0 @@ -package adopt - -import ( - "github.com/isd-sgcu/johnjud-backend/src/app/model/adopt" - "gorm.io/gorm" -) - -type Repository struct { - db *gorm.DB -} - -func NewRepository(db *gorm.DB) *Repository { - return &Repository{db: db} -} - -func (r *Repository) FindAll(result *[]*adopt.Adopt) error { - return r.db.Model(&adopt.Adopt{}).Find(result).Error -} - -func (r *Repository) Create(in *adopt.Adopt) error { - return r.db.Create(&in).Error -} - -func (r *Repository) Delete(id string) error { - return r.db.Where("id = ?", id).Delete(&adopt.Adopt{}).Error -}