Chever John 9c39c8cbd7
init: iloom WMS monorepo with K8s deployment manifests
Go workspace (go.work) with 5 microservices + shared library:
- gateway (8080), auth-service (8081), purchaser-service (8082)
- textile-service (8083), washing-service (8084)
- shared: proto definitions, common packages

Infrastructure: docker-compose for local dev, K8s manifests for
K3s cluster deployment (mysql/redis/etcd + traefik ingress).

Frontend (iloom-flatten) added as git submodule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-14 11:33:31 +08:00

36 lines
1.1 KiB
Go

package repository
import (
"context"
"database/sql"
"fmt"
"github.com/muyuqingfeng/iloom/washing-service/internal/model"
)
type CompletionRepo struct {
db *sql.DB
}
func NewCompletionRepo(db *sql.DB) *CompletionRepo {
return &CompletionRepo{db: db}
}
func (r *CompletionRepo) Create(ctx context.Context, tx *sql.Tx, c *model.WashingPlanCompletion) error {
query := `INSERT INTO ilm_washing_completion
(id, washing_plan_id, company_id, actual_shrinkage_rate, actual_washed_meters,
actual_washing_cost, unit_cost, rolls, washing_date, notes, completed_by,
completed_at, finished_product_id, auto_imported, warehouse_id, warehouse_location, created_at)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`
_, err := tx.ExecContext(ctx, query,
c.ID, c.WashingPlanID, c.CompanyID, c.ActualShrinkageRate, c.ActualWashedMeters,
c.ActualWashingCost, c.UnitCost, c.Rolls, c.WashingDate, c.Notes, c.CompletedBy,
c.CompletedAt, c.FinishedProductID, c.AutoImported, c.WarehouseID, c.WarehouseLocation,
c.CreatedAt,
)
if err != nil {
return fmt.Errorf("insert completion: %w", err)
}
return nil
}