Skip to content

Commit

Permalink
fix: standardized reponse parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajinx1 committed Aug 10, 2024
1 parent c953d29 commit 480d66b
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 12 deletions.
1 change: 0 additions & 1 deletion internal/models/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type ContactUs struct {
ID string `gorm:"type:uuid;primary_key;" json:"id"`
Name string `gorm:"type:varchar(100);not null" json:"name" binding:"required" validate:"required"`
Email string `gorm:"type:varchar(100);not null;index" json:"email" binding:"required" validate:"required,email"`
Subject string `gorm:"type:varchar(255);not null" json:"subject" binding:"required" validate:"required"`
Message string `gorm:"type:text;not null" json:"message" binding:"required" validate:"required"`
CreatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"created_at"`
UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"`
Expand Down
1 change: 0 additions & 1 deletion internal/models/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type SendSqueeze struct {
type SendContactUsMail struct {
Name string `json:"name" validate:"required"`
Email string `json:"email" `
Subject string `son:"subject" validate:"required"`
Message string `json:"message" validate:"required"`
}

Expand Down
2 changes: 0 additions & 2 deletions services/contact/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func GetAllContactUs(c *gin.Context, db *gorm.DB) ([]models.ContactUs, *postgres

func AddToContactUs(contact *models.ContactUs, db *gorm.DB) error {

contact.Subject = utility.CleanStringInput(contact.Subject)
contact.Message = utility.CleanStringInput(contact.Message)

if err := contact.CreateContactUs(db); err != nil {
Expand All @@ -44,7 +43,6 @@ func AddToContactUs(contact *models.ContactUs, db *gorm.DB) error {
msgReq := models.ContactUs{
Email: contact.Email,
Name: contact.Name,
Subject: contact.Subject,
Message: contact.Message,
}

Expand Down
2 changes: 0 additions & 2 deletions tests/test_contact/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func TestAddToContactUs(t *testing.T) {
contactData := models.ContactUs{
Name: "John Doe",
Email: "[email protected]",
Subject: "</br><i>Inquiry about services3 with html",
Message: "I would like to know more about your services3.",
}
payload, _ := json.Marshal(contactData)
Expand Down Expand Up @@ -115,7 +114,6 @@ func TestAddToContactUs(t *testing.T) {
contactData := models.ContactUs{
Name: "John Doe",
Email: "invalid_email",
Subject: "test subject",
Message: "message test",
}
payload, _ := json.Marshal(contactData)
Expand Down
1 change: 0 additions & 1 deletion tests/test_contact/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestDeleteContactUs(t *testing.T) {
contact := models.ContactUs{
ID: utility.GenerateUUID(),
Email: fmt.Sprintf("contact%[email protected]", currUUID),
Subject: fmt.Sprintf("Test subject - %v ", currUUID),
Message: fmt.Sprintf("Test message - %v ", currUUID),
}

Expand Down
4 changes: 0 additions & 4 deletions tests/test_contact/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ func TestGetAllContactUs(t *testing.T) {
contact1 := models.ContactUs{
ID: utility.GenerateUUID(),
Email: fmt.Sprintf("contact%[email protected]", currUUID),
Subject: fmt.Sprintf("First subject - %v ", currUUID),
Message: fmt.Sprintf("First test message - %v ", currUUID),
}
contact2 := models.ContactUs{
ID: utility.GenerateUUID(),
Email: fmt.Sprintf("contact2%[email protected]", currUUID),
Subject: fmt.Sprintf("Second subject - %v ", currUUID),
Message: fmt.Sprintf("Second test message - %v ", currUUID),
}

Expand Down Expand Up @@ -149,7 +147,6 @@ func TestGetContactUsById(t *testing.T) {
contact := models.ContactUs{
ID: utility.GenerateUUID(),
Email: fmt.Sprintf("contact%[email protected]", currUUID),
Subject: fmt.Sprintf("Test subject - %v ", currUUID),
Message: fmt.Sprintf("Test message - %v ", currUUID),
}

Expand Down Expand Up @@ -251,7 +248,6 @@ func TestGetContactUsByEmail(t *testing.T) {
contact := models.ContactUs{
ID: utility.GenerateUUID(),
Email: fmt.Sprintf("contact%[email protected]", currUUID),
Subject: fmt.Sprintf("Test subject - %v ", currUUID),
Message: fmt.Sprintf("Test message - %v ", currUUID),
}

Expand Down
1 change: 0 additions & 1 deletion utility/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func ResponseMessage(code int, status string, name string, message string, err i
res := Response{
StatusCode: code,
Name: name,
Status: status,
Message: message,
Error: err,
Data: data,
Expand Down

0 comments on commit 480d66b

Please sign in to comment.