feat: implement component-item management with CRUD operations and status updates
This commit is contained in:
64
sqlc_gen/component_status_history.sql.go
Normal file
64
sqlc_gen/component_status_history.sql.go
Normal file
@@ -0,0 +1,64 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// source: component_status_history.sql
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const createComponentStatusHistory = `-- name: CreateComponentStatusHistory :one
|
||||
INSERT INTO component_status_history (
|
||||
component_item_id, old_status, new_status,
|
||||
changed_quantity, note, changed_by, changed_at
|
||||
)
|
||||
VALUES (
|
||||
$1,
|
||||
$2,
|
||||
$3,
|
||||
$4,
|
||||
$5,
|
||||
$6,
|
||||
$7
|
||||
)
|
||||
RETURNING id, component_item_id, old_status, new_status, changed_quantity, note, changed_by, changed_at
|
||||
`
|
||||
|
||||
type CreateComponentStatusHistoryParams struct {
|
||||
ComponentItemID int64 `db:"component_item_id" json:"componentItemId"`
|
||||
OldStatus NullComponentItemStatusEnum `db:"old_status" json:"oldStatus"`
|
||||
NewStatus ComponentItemStatusEnum `db:"new_status" json:"newStatus"`
|
||||
ChangedQuantity pgtype.Int4 `db:"changed_quantity" json:"changedQuantity"`
|
||||
Note pgtype.Text `db:"note" json:"note"`
|
||||
ChangedBy pgtype.Text `db:"changed_by" json:"changedBy"`
|
||||
ChangedAt time.Time `db:"changed_at" json:"changedAt"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateComponentStatusHistory(ctx context.Context, arg CreateComponentStatusHistoryParams) (ComponentStatusHistory, error) {
|
||||
row := q.db.QueryRow(ctx, createComponentStatusHistory,
|
||||
arg.ComponentItemID,
|
||||
arg.OldStatus,
|
||||
arg.NewStatus,
|
||||
arg.ChangedQuantity,
|
||||
arg.Note,
|
||||
arg.ChangedBy,
|
||||
arg.ChangedAt,
|
||||
)
|
||||
var i ComponentStatusHistory
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.ComponentItemID,
|
||||
&i.OldStatus,
|
||||
&i.NewStatus,
|
||||
&i.ChangedQuantity,
|
||||
&i.Note,
|
||||
&i.ChangedBy,
|
||||
&i.ChangedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
Reference in New Issue
Block a user