From 1c5779353d008149eec0d9f2c580353534f7a0a0 Mon Sep 17 00:00:00 2001 From: ImSoZRious <30285202+ImSoZRious@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:56:16 +0700 Subject: [PATCH] fix: feedback timestamp (#37) --- internal/model/feedback.model.go | 48 +++++++++++++++++--------------- migrations/04-feedback.sql | 2 ++ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/internal/model/feedback.model.go b/internal/model/feedback.model.go index 68d40a7..25201d3 100644 --- a/internal/model/feedback.model.go +++ b/internal/model/feedback.model.go @@ -1,30 +1,34 @@ package model +import "time" + type FirstpartAnswer string type SecondPartAnswer string type Feedback struct { - User User `gorm:"foreignKey:UserId;references:Id"` - UserId int `gorm:""` - Q1 FirstpartAnswer `gorm:""` - Q2 FirstpartAnswer `gorm:""` - Q3 FirstpartAnswer `gorm:""` - Q4 FirstpartAnswer `gorm:""` - Q5 FirstpartAnswer `gorm:""` - Q6 FirstpartAnswer `gorm:""` - Q7 SecondPartAnswer `gorm:""` - Q8 SecondPartAnswer `gorm:""` - Q9 SecondPartAnswer `gorm:""` - Q10 SecondPartAnswer `gorm:""` - Q11 SecondPartAnswer `gorm:""` - Q12 SecondPartAnswer `gorm:""` - Q13 SecondPartAnswer `gorm:""` - Q14 SecondPartAnswer `gorm:""` - Q15 SecondPartAnswer `gorm:""` - Q16 SecondPartAnswer `gorm:""` - Q17 SecondPartAnswer `gorm:""` - Q18 SecondPartAnswer `gorm:""` - Q19 SecondPartAnswer `gorm:""` - Comment string `gorm:""` + User User `gorm:"foreignKey:UserId;references:Id"` + UserId int `gorm:""` + CreatedAt time.Time `gorm:"autoCreateTime"` + UpdatedAt time.Time `gorm:"autoUpdateTime:milli"` + Q1 FirstpartAnswer `gorm:""` + Q2 FirstpartAnswer `gorm:""` + Q3 FirstpartAnswer `gorm:""` + Q4 FirstpartAnswer `gorm:""` + Q5 FirstpartAnswer `gorm:""` + Q6 FirstpartAnswer `gorm:""` + Q7 SecondPartAnswer `gorm:""` + Q8 SecondPartAnswer `gorm:""` + Q9 SecondPartAnswer `gorm:""` + Q10 SecondPartAnswer `gorm:""` + Q11 SecondPartAnswer `gorm:""` + Q12 SecondPartAnswer `gorm:""` + Q13 SecondPartAnswer `gorm:""` + Q14 SecondPartAnswer `gorm:""` + Q15 SecondPartAnswer `gorm:""` + Q16 SecondPartAnswer `gorm:""` + Q17 SecondPartAnswer `gorm:""` + Q18 SecondPartAnswer `gorm:""` + Q19 SecondPartAnswer `gorm:""` + Comment string `gorm:""` } diff --git a/migrations/04-feedback.sql b/migrations/04-feedback.sql index bb610f7..7f9d0ff 100644 --- a/migrations/04-feedback.sql +++ b/migrations/04-feedback.sql @@ -17,6 +17,8 @@ CREATE TYPE feedback_second_part_answer AS ENUM ( CREATE TABLE feedbacks ( "user_id" INT NOT NULL, + "created_at" timestamptz NOT NULL, + "updated_at" timestamptz NOT NULL, "q1" feedback_first_part_answer NOT NULL, "q2" feedback_first_part_answer NOT NULL, "q3" feedback_first_part_answer NOT NULL,