Restructurization

This commit is contained in:
Piotr Biernat
2024-12-06 13:24:56 +01:00
parent f9acb885a8
commit d7d8ac5091
19 changed files with 113 additions and 52 deletions

8
order/dto/dto.go Normal file
View File

@@ -0,0 +1,8 @@
package order
type UpdateOrderStatusRequestDTO struct {
Status string `json:"status"`
}
type UpdateOrderStatusResponseDTO struct {
}

20
order/entity/entity.go Normal file
View File

@@ -0,0 +1,20 @@
package order
import "github.com/jackc/pgtype"
type OrderEntity struct {
ID string `db:"id" json:"id"`
State string `db:"state" json:"state"`
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
}
type OrderItemEntity struct {
ID string `db:"id" json:"id"`
OrderID string `db:"order_id" json:"order_id"`
ProductID int `db:"product_id" json:"product_id"`
Quantity int `db:"quantity" json:"quantity"`
Price float64 `db:"price" json:"price"`
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
}

20
order/model/model.go Normal file
View File

@@ -0,0 +1,20 @@
package order
import "github.com/jackc/pgtype"
type OrderModel struct {
// ID string `db:"id" json:"id"`
State string `db:"state" json:"state"`
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
}
type OrderItemModel struct {
// ID string `db:"id" json:"id"`
OrderID string `db:"order_id" json:"order_id"`
ProductID int `db:"product_id" json:"product_id"`
Quantity int `db:"quantity" json:"quantity"`
Price float64 `db:"price" json:"price"`
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
}