Initial project setup

This commit is contained in:
Arne Weiss
2022-09-02 22:40:21 +02:00
commit ce35c0300c
41 changed files with 1127 additions and 0 deletions

0
Application/Fixtures.sql Normal file
View File

View File

@@ -0,0 +1,5 @@
module Application.Helper.Controller where
import IHP.ControllerPrelude
-- Here you can add functions which are available in all your controllers

View File

@@ -0,0 +1,5 @@
module Application.Helper.View where
import IHP.ViewPrelude
-- Here you can add functions which are available in all your views

View File

@@ -0,0 +1,14 @@
CREATE TABLE entries (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
started TIMESTAMP WITH TIME ZONE DEFAULT date_trunc('minute', now()) NOT NULL,
till TIMESTAMP WITH TIME ZONE DEFAULT null,
"day" INT DEFAULT day_epoch(now()) NOT NULL,
"comment" TEXT DEFAULT null,
isfree BOOLEAN DEFAULT false NOT NULL
);
CREATE TABLE weekly_worktimes (
"year" int2 NOT NULL,
"month" int2 NOT NULL,
worktime int2 NOT NULL,
CONSTRAINT weekly_worktime_pk PRIMARY KEY (month, year)
);

View File

@@ -0,0 +1,27 @@
CREATE OR REPLACE FUNCTION public.day_epoch(dtime timestamp with time zone)
RETURNS integer
LANGUAGE plpgsql
AS $function$
begin
SET TIME ZONE 'Europe/Berlin';
RETURN FLOOR(EXTRACT(EPOCH FROM dtime)/(24*3600));
end;
$function$
;
CREATE TABLE entries (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
started TIMESTAMP WITH TIME ZONE DEFAULT date_trunc('minute', now()) NOT NULL,
till TIMESTAMP WITH TIME ZONE DEFAULT null,
"day" INT DEFAULT day_epoch(now()) NOT NULL,
"comment" TEXT DEFAULT null,
isfree BOOLEAN DEFAULT false NOT NULL
);
CREATE TABLE weekly_worktimes (
"year" int2 NOT NULL,
"month" int2 NOT NULL,
worktime int2 NOT NULL,
CONSTRAINT weekly_worktime_pk PRIMARY KEY (month, year)
);

14
Application/Schema.sql Normal file
View File

@@ -0,0 +1,14 @@
-- Your database schema. Use the Schema Designer at http://localhost:8001/ to add some tables.
CREATE TABLE entries (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
started TIMESTAMP WITH TIME ZONE DEFAULT date_trunc(('minute'::TEXT), now()) NOT NULL,
till TIMESTAMP WITH TIME ZONE,
"day" INT DEFAULT day_epoch(now()) NOT NULL,
"comment" TEXT DEFAULT NULL,
isfree BOOLEAN DEFAULT false NOT NULL
);
CREATE TABLE weekly_worktimes (
"month" INT NOT NULL,
"year" INT NOT NULL,
worktime INT NOT NULL
);

View File

@@ -0,0 +1,12 @@
module Application.Script.Prelude
( module IHP.ControllerPrelude
, module Generated.Types
, module IHP.Prelude
, module IHP.ScriptSupport
)
where
import IHP.Prelude
import IHP.ControllerPrelude
import Generated.Types
import IHP.ScriptSupport