created setup and backend structure

This commit is contained in:
z1glr
2025-01-07 00:51:03 +00:00
parent 063f22569d
commit 03b2b0e206
11 changed files with 306 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm"
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

1
setup/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
config.yaml

13
setup/go.mod Normal file
View File

@@ -0,0 +1,13 @@
module github.com/johannesbuehl/golunteer/setup
go 1.23.4
require (
github.com/go-sql-driver/mysql v1.8.1
gopkg.in/yaml.v3 v3.0.1
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
golang.org/x/crypto v0.32.0
)

9
setup/go.sum Normal file
View File

@@ -0,0 +1,9 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

44
setup/setup.sql Normal file
View File

@@ -0,0 +1,44 @@
CREATE TABLE TASKS (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
text varchar(64) NOT NULL,
disabled BOOL DEFAULT(false)
);
CREATE TABLE AVAILABILITIES (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
text varchar(32) NOT NULL,
disabled BOOL DEFAULT(false)
);
CREATE TABLE USERS (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name varchar(64) NOT NULL,
password binary(60) NOT NULL,
admin BOOL NOT NULL DEFAULT(false)
);
CREATE TABLE EVENTS (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
date DATETIME NOT NULL,
description TEXT DEFAULT("")
);
CREATE TABLE USER_AVAILABILITIES (
userID INTEGER NOT NULL,
eventID INTEGER NOT NULL,
availabilityID INTEGER NOT NULL,
PRIMARY KEY (userID, eventID),
FOREIGN KEY (userID) REFERENCES USERS(id) ON DELETE CASCADE,
FOREIGN KEY (eventID) REFERENCES EVENTS(id) ON DELETE CASCADE,
FOREIGN KEY (avaibID) REFERENCES AVAILABILITIES(id) ON DELETE RESTRICT,
);
CREATE TABLE USER_ASSIGNMENTS (
eventID INTEGER NOT NULL,
taskID INTEGER NOT NULL,
userID INTEGER NOT NULL,
PRIMARY KEY (eventID, taskID),
FOREIGN KEY (userID) REFERENCES USERS(id) ON DELETE CASCADE,
FOREIGN KEY (taskID) REFERENCES TASKS(id) ON DELETE RESTRICT,
FOREIGN KEY (eventID) REFERENCES EVENTS(id) ON DELETE CASCADE
);