87 lines
4.4 KiB
Bash
87 lines
4.4 KiB
Bash
|
|
|
|
|
|
# Server configuration
|
|
PORT=3001
|
|
|
|
# Environment variables for Supabase configuration
|
|
SUPABASE_URL=https://spobwqqaskuhcmyeklgk.supabase.co
|
|
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNwb2J3cXFhc2t1aGNteWVrbGdrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE4NzU1NDcsImV4cCI6MjA3NzQ1MTU0N30.oJevtZ5RykT0QkALQdoIKL6OQoTKkNHCCjGaK8I1-2I
|
|
|
|
|
|
# -- WARNING: This schema is for context only and is not meant to be run.
|
|
# -- Table order and constraints may not be valid for execution.
|
|
|
|
# CREATE TABLE public.categories (
|
|
# category_id integer NOT NULL DEFAULT nextval('categories_category_id_seq'::regclass),
|
|
# name character varying NOT NULL,
|
|
# description text,
|
|
# CONSTRAINT categories_pkey PRIMARY KEY (category_id)
|
|
# );
|
|
# CREATE TABLE public.inventory_logs (
|
|
# log_id integer NOT NULL DEFAULT nextval('inventory_logs_log_id_seq'::regclass),
|
|
# product_id integer,
|
|
# user_id integer,
|
|
# action character varying CHECK (action::text = ANY (ARRAY['add'::character varying, 'remove'::character varying, 'sale'::character varying, 'adjust'::character varying]::text[])),
|
|
# quantity integer NOT NULL,
|
|
# remarks text,
|
|
# log_date timestamp without time zone DEFAULT now(),
|
|
# CONSTRAINT inventory_logs_pkey PRIMARY KEY (log_id),
|
|
# CONSTRAINT inventory_logs_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.products(product_id),
|
|
# CONSTRAINT inventory_logs_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(user_id)
|
|
# );
|
|
# CREATE TABLE public.products (
|
|
# product_id integer NOT NULL DEFAULT nextval('products_product_id_seq'::regclass),
|
|
# barcode character varying,
|
|
# name character varying NOT NULL,
|
|
# category_id integer,
|
|
# price numeric NOT NULL,
|
|
# cost numeric,
|
|
# stock integer DEFAULT 0,
|
|
# unit character varying DEFAULT 'pcs'::character varying,
|
|
# created_at timestamp without time zone DEFAULT now(),
|
|
# updated_at timestamp without time zone DEFAULT now(),
|
|
# CONSTRAINT products_pkey PRIMARY KEY (product_id),
|
|
# CONSTRAINT products_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.categories(category_id)
|
|
# );
|
|
# CREATE TABLE public.sale_items (
|
|
# sale_item_id integer NOT NULL DEFAULT nextval('sale_items_sale_item_id_seq'::regclass),
|
|
# sale_id integer,
|
|
# product_id integer,
|
|
# quantity integer NOT NULL,
|
|
# price numeric NOT NULL,
|
|
# total numeric DEFAULT ((quantity)::numeric * price),
|
|
# CONSTRAINT sale_items_pkey PRIMARY KEY (sale_item_id),
|
|
# CONSTRAINT sale_items_sale_id_fkey FOREIGN KEY (sale_id) REFERENCES public.sales(sale_id),
|
|
# CONSTRAINT sale_items_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.products(product_id)
|
|
# );
|
|
# CREATE TABLE public.sales (
|
|
# sale_id integer NOT NULL DEFAULT nextval('sales_sale_id_seq'::regclass),
|
|
# user_id integer,
|
|
# total_amount numeric NOT NULL,
|
|
# payment_type character varying DEFAULT 'cash'::character varying CHECK (payment_type::text = ANY (ARRAY['cash'::character varying, 'gcash'::character varying, 'card'::character varying]::text[])),
|
|
# amount_tendered numeric,
|
|
# change_due numeric,
|
|
# sale_date timestamp without time zone DEFAULT now(),
|
|
# status character varying DEFAULT 'completed'::character varying CHECK (status::text = ANY (ARRAY['completed'::character varying, 'voided'::character varying, 'refunded'::character varying]::text[])),
|
|
# CONSTRAINT sales_pkey PRIMARY KEY (sale_id),
|
|
# CONSTRAINT sales_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(user_id)
|
|
# );
|
|
# CREATE TABLE public.settings (
|
|
# setting_id integer NOT NULL DEFAULT nextval('settings_setting_id_seq'::regclass),
|
|
# store_name character varying,
|
|
# address character varying,
|
|
# contact character varying,
|
|
# tax_rate numeric DEFAULT 0.00,
|
|
# CONSTRAINT settings_pkey PRIMARY KEY (setting_id)
|
|
# );
|
|
# CREATE TABLE public.users (
|
|
# user_id integer NOT NULL DEFAULT nextval('users_user_id_seq'::regclass),
|
|
# full_name character varying NOT NULL,
|
|
# username character varying NOT NULL UNIQUE,
|
|
# password text NOT NULL,
|
|
# role character varying DEFAULT 'cashier'::character varying CHECK (role::text = ANY (ARRAY['admin'::character varying, 'cashier'::character varying]::text[])),
|
|
# status character varying DEFAULT 'active'::character varying CHECK (status::text = ANY (ARRAY['active'::character varying, 'inactive'::character varying]::text[])),
|
|
# created_at timestamp without time zone DEFAULT now(),
|
|
# CONSTRAINT users_pkey PRIMARY KEY (user_id)
|
|
# ); |