Initial project setup
This commit is contained in:
0
Application/Fixtures.sql
Normal file
0
Application/Fixtures.sql
Normal file
5
Application/Helper/Controller.hs
Normal file
5
Application/Helper/Controller.hs
Normal 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
|
||||
5
Application/Helper/View.hs
Normal file
5
Application/Helper/View.hs
Normal 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
|
||||
14
Application/Migration/1662146613.sql
Normal file
14
Application/Migration/1662146613.sql
Normal 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)
|
||||
);
|
||||
27
Application/Migration/1662146709.sql
Normal file
27
Application/Migration/1662146709.sql
Normal 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
14
Application/Schema.sql
Normal 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
|
||||
);
|
||||
12
Application/Script/Prelude.hs
Normal file
12
Application/Script/Prelude.hs
Normal 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
|
||||
Reference in New Issue
Block a user