chore: restructure project into backend and frontend folders
- Move all frontend code to frontend/ directory - Add backend/ with Go project structure (cmd, internal, pkg) - Add docker-compose.yml for orchestration
This commit is contained in:
159
backend/internal/db/sqlc/query.sql.go
Normal file
159
backend/internal/db/sqlc/query.sql.go
Normal file
@@ -0,0 +1,159 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// source: query.sql
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const createDelivery = `-- name: CreateDelivery :one
|
||||
INSERT INTO deliveries (date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at
|
||||
`
|
||||
|
||||
type CreateDeliveryParams struct {
|
||||
Date pgtype.Date `db:"date" json:"date"`
|
||||
PickupLocation string `db:"pickup_location" json:"pickup_location"`
|
||||
ProductName string `db:"product_name" json:"product_name"`
|
||||
Address string `db:"address" json:"address"`
|
||||
Phone string `db:"phone" json:"phone"`
|
||||
AdditionalPhone pgtype.Text `db:"additional_phone" json:"additional_phone"`
|
||||
HasElevator bool `db:"has_elevator" json:"has_elevator"`
|
||||
Comment pgtype.Text `db:"comment" json:"comment"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateDelivery(ctx context.Context, arg CreateDeliveryParams) (Delivery, error) {
|
||||
row := q.db.QueryRow(ctx, createDelivery,
|
||||
arg.Date,
|
||||
arg.PickupLocation,
|
||||
arg.ProductName,
|
||||
arg.Address,
|
||||
arg.Phone,
|
||||
arg.AdditionalPhone,
|
||||
arg.HasElevator,
|
||||
arg.Comment,
|
||||
)
|
||||
var i Delivery
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Date,
|
||||
&i.PickupLocation,
|
||||
&i.ProductName,
|
||||
&i.Address,
|
||||
&i.Phone,
|
||||
&i.AdditionalPhone,
|
||||
&i.HasElevator,
|
||||
&i.Comment,
|
||||
&i.Status,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteDelivery = `-- name: DeleteDelivery :exec
|
||||
DELETE FROM deliveries WHERE id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteDelivery(ctx context.Context, id pgtype.UUID) error {
|
||||
_, err := q.db.Exec(ctx, deleteDelivery, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const getDeliveriesByDate = `-- name: GetDeliveriesByDate :many
|
||||
SELECT id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at FROM deliveries WHERE date = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetDeliveriesByDate(ctx context.Context, date pgtype.Date) ([]Delivery, error) {
|
||||
rows, err := q.db.Query(ctx, getDeliveriesByDate, date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []Delivery{}
|
||||
for rows.Next() {
|
||||
var i Delivery
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Date,
|
||||
&i.PickupLocation,
|
||||
&i.ProductName,
|
||||
&i.Address,
|
||||
&i.Phone,
|
||||
&i.AdditionalPhone,
|
||||
&i.HasElevator,
|
||||
&i.Comment,
|
||||
&i.Status,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getDeliveryByID = `-- name: GetDeliveryByID :one
|
||||
SELECT id, date, pickup_location, product_name, address, phone, additional_phone, has_elevator, comment, status, created_at, updated_at FROM deliveries WHERE id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetDeliveryByID(ctx context.Context, id pgtype.UUID) (Delivery, error) {
|
||||
row := q.db.QueryRow(ctx, getDeliveryByID, id)
|
||||
var i Delivery
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Date,
|
||||
&i.PickupLocation,
|
||||
&i.ProductName,
|
||||
&i.Address,
|
||||
&i.Phone,
|
||||
&i.AdditionalPhone,
|
||||
&i.HasElevator,
|
||||
&i.Comment,
|
||||
&i.Status,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateDelivery = `-- name: UpdateDelivery :exec
|
||||
UPDATE deliveries SET date = $1, pickup_location = $2, product_name = $3, address = $4, phone = $5, additional_phone = $6, has_elevator = $7, comment = $8, updated_at = NOW() WHERE id = $9
|
||||
`
|
||||
|
||||
type UpdateDeliveryParams struct {
|
||||
Date pgtype.Date `db:"date" json:"date"`
|
||||
PickupLocation string `db:"pickup_location" json:"pickup_location"`
|
||||
ProductName string `db:"product_name" json:"product_name"`
|
||||
Address string `db:"address" json:"address"`
|
||||
Phone string `db:"phone" json:"phone"`
|
||||
AdditionalPhone pgtype.Text `db:"additional_phone" json:"additional_phone"`
|
||||
HasElevator bool `db:"has_elevator" json:"has_elevator"`
|
||||
Comment pgtype.Text `db:"comment" json:"comment"`
|
||||
ID pgtype.UUID `db:"id" json:"id"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateDelivery(ctx context.Context, arg UpdateDeliveryParams) error {
|
||||
_, err := q.db.Exec(ctx, updateDelivery,
|
||||
arg.Date,
|
||||
arg.PickupLocation,
|
||||
arg.ProductName,
|
||||
arg.Address,
|
||||
arg.Phone,
|
||||
arg.AdditionalPhone,
|
||||
arg.HasElevator,
|
||||
arg.Comment,
|
||||
arg.ID,
|
||||
)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user