diff --git a/README.md b/README.md deleted file mode 100644 index 1c1014a..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# Time Management Platform diff --git a/backend/Makefile b/backend/Makefile deleted file mode 100644 index ed14841..0000000 --- a/backend/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# Go parameters -GOCMD = go -GOBUILD = $(GOCMD) build -GOCLEAN = $(GOCMD) clean -GOTEST = $(GOCMD) test -GOGET = $(GOCMD) get - -# SQLite database filename -DB_FILE = db.sqlite3 - -# Directory containing migration SQL scripts -MIGRATIONS_DIR = migrations - -# Build target -build: - $(GOBUILD) -o bin/server cmd/*.go - -# Run target -run: build - ./bin/server - -# Clean target -clean: - $(GOCLEAN) - rm -f bin/server - rm -f db.sqlite3 - -# Test target -test: - $(GOTEST) ./... - -# Get dependencies target -deps: - $(GOGET) -v ./... - -# Update dependencies target -update: - $(GOGET) -u -v ./... - $(GOCMD) mod tidy - -# Migration target -migrate: - @echo "Migrating database $(DB_FILE) using SQL scripts in $(MIGRATIONS_DIR)" - @for file in $(wildcard $(MIGRATIONS_DIR)/*.sql); do \ - echo "Applying migration: $$file"; \ - sqlite3 $(DB_FILE) < $$file; \ - done - -# Default target -default: build \ No newline at end of file diff --git a/backend/cmd/main.go b/backend/cmd/main.go deleted file mode 100644 index 98fcc96..0000000 --- a/backend/cmd/main.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -import ( - "fmt" - "io" - "net/http" - "tmp/internal/database" - - _ "github.com/mattn/go-sqlite3" -) - -// This is what a handler looks like -func handler(w http.ResponseWriter, r *http.Request) { - fmt.Println("Request received") - io.WriteString(w, "This is my website!\n") -} - -func main() { - println("Starting server...") - database.DbConnect() - - // Mounting the handler - fs := http.FileServer(http.Dir("static")) - http.Handle("/", fs) - http.HandleFunc("/hello", handler) - - // Start the server on port 8080 - err := http.ListenAndServe(":8080", nil) - if err != nil { - panic(err) - } -} diff --git a/backend/go.mod b/backend/go.mod deleted file mode 100644 index 005dcc6..0000000 --- a/backend/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module tmp - -go 1.21.1 - -require ( - github.com/jmoiron/sqlx v1.3.5 - github.com/mattn/go-sqlite3 v1.14.22 -) diff --git a/backend/go.sum b/backend/go.sum deleted file mode 100644 index ee85dd9..0000000 --- a/backend/go.sum +++ /dev/null @@ -1,9 +0,0 @@ -github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= -github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= -github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= -github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= diff --git a/backend/internal/database/db.go b/backend/internal/database/db.go deleted file mode 100644 index d99efde..0000000 --- a/backend/internal/database/db.go +++ /dev/null @@ -1,32 +0,0 @@ -package database - -import ( - "os" - - "github.com/jmoiron/sqlx" - _ "github.com/mattn/go-sqlite3" -) - -func DbConnect() *sqlx.DB { - // Check for the environment variable - dbpath := os.Getenv("SQLITE_DB_PATH") - - // Default to something reasonable - if dbpath == "" { - dbpath = "./db.sqlite3" - } - - // Open the database - // db, err := sqlx.Connect("sqlite3", ":memory:") - db, err := sqlx.Connect("sqlite3", dbpath) - if err != nil { - panic(err) - } - - err = db.Ping() - if err != nil { - panic(err) - } - - return db -} diff --git a/backend/internal/database/db_test.go b/backend/internal/database/db_test.go deleted file mode 100644 index d7b26c9..0000000 --- a/backend/internal/database/db_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package database - -import ( - "testing" -) - -func TestDbConnect(t *testing.T) { - db := DbConnect() - _ = db -} diff --git a/backend/migrations/0010.sql b/backend/migrations/0010.sql deleted file mode 100644 index 11be51c..0000000 --- a/backend/migrations/0010.sql +++ /dev/null @@ -1,7 +0,0 @@ -PRAGMA foreign_keys = ON; - -CREATE TABLE IF NOT EXISTS users ( - id INTEGER PRIMARY KEY, - username VARCHAR(255) NOT NULL, - password VARCHAR(255) NOT NULL -);