26 lines
1.4 KiB
SQL
26 lines
1.4 KiB
SQL
-- +goose Up
|
|
|
|
-- Задачи — internal staff to-do board, deliberately separate from orders
|
|
-- (internal/order) and bookings (internal/booking): "позвонить поставщику",
|
|
-- "заказать этикетки", "перезвонить клиенту по гарантии" — things that
|
|
-- need tracking but aren't a repair job with a device attached. Every
|
|
-- staff role sees this (staffAuth only, no permission gate in main.go) —
|
|
-- unlike Касса/Аналитика this carries no financial data.
|
|
CREATE TABLE staff_tasks (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
title TEXT NOT NULL,
|
|
description TEXT,
|
|
status TEXT NOT NULL DEFAULT 'new' CHECK (status IN ('new', 'in_progress', 'postponed', 'done')),
|
|
assigned_staff_id UUID,
|
|
assigned_staff_name TEXT,
|
|
due_date DATE,
|
|
created_by_staff_id UUID NOT NULL,
|
|
created_by_staff_name TEXT NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
completed_at TIMESTAMPTZ
|
|
);
|
|
CREATE INDEX staff_tasks_status_idx ON staff_tasks (status);
|
|
CREATE INDEX staff_tasks_assigned_staff_id_idx ON staff_tasks (assigned_staff_id) WHERE assigned_staff_id IS NOT NULL;
|
|
CREATE INDEX staff_tasks_created_at_idx ON staff_tasks (created_at DESC);
|