diff --git a/.gitignore b/.gitignore index 8f9be7b..2d89407 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ *.dylib bin -database.txt db.sqlite3 *.png diff --git a/backend/Makefile b/backend/Makefile index 2547900..d005846 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -54,9 +54,6 @@ migrate: db.sqlite3: make migrate -dbdump: - sqlite3 $(DB_FILE) .dump > database.txt - backup: mkdir -p backups sqlite3 $(DB_FILE) .dump | gzip -9 > ./backups/BACKUP_$(DB_FILE)_$(shell date +"%Y-%m-%d_%H:%M:%S").sql.gz diff --git a/backend/internal/database/db.go b/backend/internal/database/db.go index 5221e4d..820c1f2 100644 --- a/backend/internal/database/db.go +++ b/backend/internal/database/db.go @@ -19,7 +19,6 @@ type Database interface { GetUserId(username string) (int, error) AddProject(name string, description string, username string) error Migrate(dirname string) error - GetProjectId(projectname string) (int, error) AddTimeReport(projectName string, userName string, start time.Time, end time.Time) error AddUserToProject(username string, projectname string, role string) error ChangeUserRole(username string, projectname string, role string) error @@ -124,7 +123,7 @@ func (d *Db) GetUserId(username string) (int, error) { return id, err } -func (d *Db) GetProjectId(projectname string) (int, error) { +func (d *Db) GetProjectId(projectname string) (int, error) { // WIP, denna kan vara goof var id int err := d.Get(&id, "SELECT id FROM projects WHERE name = ?", projectname) return id, err diff --git a/backend/internal/database/migrations/0049_project_role.sql b/backend/internal/database/migrations/0049_project_role.sql index f7e7151..8716800 100644 --- a/backend/internal/database/migrations/0049_project_role.sql +++ b/backend/internal/database/migrations/0049_project_role.sql @@ -5,5 +5,5 @@ CREATE TABLE IF NOT EXISTS project_role ( ); -- Insert the possible roles a user can have in a project. -INSERT OR IGNORE INTO project_role (p_role) VALUES ('project_manager'); +INSERT OR IGNORE INTO project_role (p_role) VALUES ('admin'); INSERT OR IGNORE INTO project_role (p_role) VALUES ('member'); diff --git a/backend/internal/database/migrations/0050_user_roles.sql b/backend/internal/database/migrations/0050_user_roles.sql index d3e614d..aad25f7 100644 --- a/backend/internal/database/migrations/0050_user_roles.sql +++ b/backend/internal/database/migrations/0050_user_roles.sql @@ -1,7 +1,7 @@ CREATE TABLE IF NOT EXISTS user_roles ( user_id INTEGER NOT NULL, project_id INTEGER NOT NULL, - p_role TEXT NOT NULL, -- 'project_manager' or 'member' + p_role TEXT NOT NULL, -- 'admin' or 'member' FOREIGN KEY (user_id) REFERENCES users (id) FOREIGN KEY (project_id) REFERENCES projects (id) FOREIGN KEY (p_role) REFERENCES project_role (p_role)