Update Api

This commit is contained in:
2025-06-23 11:27:43 +07:00
parent 40705fbf3b
commit dc8aafbbc1
8 changed files with 188 additions and 16 deletions
+9 -5
View File
@@ -1,10 +1,14 @@
package models
import "time"
import (
"time"
)
type Collection struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null" json:"name"`
CreatedAt time.Time
UpdatedAt time.Time
ID uint `gorm:"primaryKey" json:"id"`
Code string `gorm:"not null;unique" json:"code"`
Name string `gorm:"not null" json:"name"`
Description string `json:"description"`
CreatedAt time.Time
UpdatedAt time.Time
}
+2 -1
View File
@@ -4,8 +4,9 @@ import "time"
type Colour struct {
ID uint `gorm:"primaryKey" json:"id"`
Code string `json:"code"`
Name string `gorm:"not null" json:"name"`
Code string `json:"code"` // contoh: HEX (#000000) atau RGB
Hex string `json:"hex"` // Hexadecimal color code
CreatedAt time.Time
UpdatedAt time.Time
}
+6 -4
View File
@@ -16,10 +16,12 @@ type Product struct {
SizeID uint `json:"size_id"`
Size Size `gorm:"foreignKey:SizeID" json:"size"`
SKU string `gorm:"not null;unique" json:"sku"`
Name string `gorm:"not null" json:"name"`
Description string `json:"description"`
UnitOfMeasure string `json:"unit_of_measure"`
SKU string `gorm:"not null;unique" json:"sku"`
Name string `gorm:"not null" json:"name"`
Description string `json:"description"`
Price float64 `gorm:"not null" json:"price"`
Hpp float64 `gorm:"not null" json:"hpp"`
UnitOfMeasure string `json:"unit_of_measure"`
IsRawMaterial bool `json:"is_raw_material"`
IsFinishedGood bool `json:"is_finished_good"`
+6 -4
View File
@@ -3,8 +3,10 @@ package models
import "time"
type ProductCategory struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null" json:"name"`
CreatedAt time.Time
UpdatedAt time.Time
ID uint `gorm:"primaryKey" json:"id"`
Code string `gorm:"not null;unique" json:"code"`
Name string `gorm:"not null" json:"name"`
Description string `json:"description"`
CreatedAt time.Time
UpdatedAt time.Time
}
@@ -12,6 +12,8 @@ type ProductComponent struct {
Component Product `gorm:"foreignKey:ComponenID" json:"component"`
Quantity float64 `json:"quantity"`
Unit string `json:"unit"` // Satuan dari komponen
Note string `json:"note,omitempty"`
CreatedAt time.Time
UpdatedAt time.Time
+3 -2
View File
@@ -4,8 +4,9 @@ import "time"
type Size struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"not null" json:"name"` // contoh: S, M, L, XL
Description string `json:"description"` // opsional, seperti "Small", "Large"
Code string `gorm:"not null;unique" json:"code"` // contoh: S, M, L, XL
Name string `gorm:"not null" json:"name"` // contoh: S, M, L, XL
Description string `json:"description"` // opsional, seperti "Small", "Large"
CreatedAt time.Time
UpdatedAt time.Time
}
+1
View File
@@ -6,6 +6,7 @@ type Warehouse struct {
ID uint `gorm:"primaryKey" json:"id"`
Kode string `gorm:"not null;unique" json:"kode"`
Name string `gorm:"not null" json:"name"`
Type string `gorm:"not null" json:"type"`
Address string `json:"address"`
Stackholder string `json:"stackholder"`
Number string `json:"number"`