This commit is contained in:
aditya.siregar
2025-04-05 11:28:06 +08:00
parent 118ec58521
commit c642c5c61b
35 changed files with 1194 additions and 212 deletions
+55 -9
View File
@@ -1,19 +1,23 @@
package models
import (
"github.com/google/uuid"
"time"
)
type CustomerDB struct {
ID int64 `gorm:"primaryKey;column:id"`
Name string `gorm:"column:name"`
Email string `gorm:"column:email"`
Phone string `gorm:"column:phone"`
Points int `gorm:"column:points"`
CreatedAt time.Time `gorm:"column:created_at"`
UpdatedAt time.Time `gorm:"column:updated_at"`
CustomerID string `gorm:"column:customer_id"`
BirthDate time.Time `gorm:"column:birth_date"`
ID int64 `gorm:"primaryKey;column:id"`
Name string `gorm:"column:name"`
Email string `gorm:"column:email"`
Phone string `gorm:"column:phone"`
Points int `gorm:"column:points"`
CreatedAt time.Time `gorm:"column:created_at"`
UpdatedAt time.Time `gorm:"column:updated_at"`
CustomerID string `gorm:"column:customer_id"`
BirthDate time.Time `gorm:"column:birth_date"`
Password string `gorm:"column:password"`
IsEmailVerified bool `gorm:"column:is_email_verified"`
IsPhoneVerified bool `gorm:"column:is_phone_verified"`
}
func (CustomerDB) TableName() string {
@@ -30,3 +34,45 @@ type PartnerMemberSequence struct {
func (PartnerMemberSequence) TableName() string {
return "partner_member_sequences"
}
type CustomerPointsDB struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement"`
CustomerID uint64 `gorm:"column:customer_id;not null"`
TotalPoints int `gorm:"column:total_points;not null;default:0"`
AvailablePoints int `gorm:"column:available_points;not null;default:0"`
LastUpdated time.Time `gorm:"column:last_updated;default:CURRENT_TIMESTAMP"`
}
func (CustomerPointsDB) TableName() string {
return "customer_points"
}
type CustomerPointTransactionDB struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement"`
CustomerID int64 `gorm:"column:customer_id;not null"`
Reference string `gorm:"column:transaction_id"`
PointsEarned int `gorm:"column:points_earned;not null"`
TransactionDate time.Time `gorm:"column:transaction_date;not null"`
ExpirationDate *time.Time `gorm:"column:expiration_date"`
Status string `gorm:"column:status;default:active"`
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP"`
}
func (CustomerPointTransactionDB) TableName() string {
return "customer_point_transactions"
}
type CustomerVerificationCodeDB struct {
ID uint64 `gorm:"column:id;primaryKey;autoIncrement"`
CustomerID uint64 `gorm:"column:customer_id;not null"`
Code string `gorm:"column:code;not null"`
Type string `gorm:"column:type;not null"`
ExpiresAt time.Time `gorm:"column:expires_at;not null"`
IsUsed bool `gorm:"column:is_used;default:false"`
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP"`
VerificationID uuid.UUID `gorm:"column:verification_id;type:uuid;default:uuid_generate_v4()"`
}
func (CustomerVerificationCodeDB) TableName() string {
return "customer_verification_codes"
}
@@ -0,0 +1,35 @@
package models
import "time"
type InProgressOrderDB struct {
ID string `gorm:"primaryKey;column:id"`
PartnerID int64 `gorm:"column:partner_id"`
CustomerID *int64 `gorm:"column:customer_id"`
CustomerName string `gorm:"column:customer_name"`
PaymentType string `gorm:"column:payment_type"`
CreatedBy int64 `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"column:created_at"`
UpdatedAt time.Time `gorm:"column:updated_at"`
TableNumber string `gorm:"column:table_number"`
OrderItems []InProgressOrderItemDB `gorm:"foreignKey:InProgressOrderIO"`
OrderType string `gorm:"column:order_type"`
}
type InProgressOrderItemDB struct {
ID int64 `gorm:"primaryKey;column:id"`
InProgressOrderIO string `gorm:"column:in_progress_order_id"`
ItemID int64 `gorm:"column:item_id"`
Quantity int `gorm:"column:quantity"`
CreatedBy int64 `gorm:"column:created_by"`
CreatedAt time.Time `gorm:"column:created_at"`
Product ProductDB `gorm:"foreignKey:ItemID;references:ID"`
}
func (InProgressOrderItemDB) TableName() string {
return "in_progress_order_items"
}
func (InProgressOrderDB) TableName() string {
return "in_progress_order"
}
+3
View File
@@ -58,6 +58,9 @@ type OrderInquiryDB struct {
UpdatedAt time.Time `gorm:"column:updated_at"`
ExpiresAt time.Time `gorm:"column:expires_at"`
InquiryItems []InquiryItemDB `gorm:"foreignKey:InquiryID"`
PaymentProvider string `gorm:"column:payment_provider"`
TableNumber string `gorm:"column:table_number"`
OrderType string `gorm:"column:order_type"`
}
func (OrderInquiryDB) TableName() string {
+1
View File
@@ -15,6 +15,7 @@ type ProductDB struct {
Status string `gorm:"column:status"`
CreatedAt time.Time `gorm:"column:created_at"`
UpdatedAt time.Time `gorm:"column:updated_at"`
Image string `gorm:"column:image"`
}
func (ProductDB) TableName() string {