cleanup
This commit is contained in:
parent
0b23c5f8f1
commit
6acfdd36b2
1 changed files with 0 additions and 19 deletions
|
@ -16,7 +16,6 @@ type Database interface {
|
||||||
AddUser(username string, password string) error
|
AddUser(username string, password string) error
|
||||||
RemoveUser(username string) error
|
RemoveUser(username string) error
|
||||||
PromoteToAdmin(username string) error
|
PromoteToAdmin(username string) error
|
||||||
PromoteToAdmin(username string) error
|
|
||||||
GetUserId(username string) (int, error)
|
GetUserId(username string) (int, error)
|
||||||
AddProject(name string, description string, username string) error
|
AddProject(name string, description string, username string) error
|
||||||
Migrate(dirname string) error
|
Migrate(dirname string) error
|
||||||
|
@ -40,11 +39,6 @@ var scripts embed.FS
|
||||||
const userInsert = "INSERT INTO users (username, password) VALUES (?, ?)"
|
const userInsert = "INSERT INTO users (username, password) VALUES (?, ?)"
|
||||||
const projectInsert = "INSERT INTO projects (name, description, user_id) SELECT ?, ?, id FROM users WHERE username = ?"
|
const projectInsert = "INSERT INTO projects (name, description, user_id) SELECT ?, ?, id FROM users WHERE username = ?"
|
||||||
const promoteToAdmin = "INSERT INTO site_admin (admin_id) SELECT id FROM users WHERE username = ?"
|
const promoteToAdmin = "INSERT INTO site_admin (admin_id) SELECT id FROM users WHERE username = ?"
|
||||||
|
|
||||||
// const addTimeReport = ""
|
|
||||||
// const addUserToProject = ""
|
|
||||||
// const changeUserRole = ""
|
|
||||||
const promoteToAdmin = "INSERT INTO site_admin (admin_id) SELECT id FROM users WHERE username = ?"
|
|
||||||
const addTimeReport = "INSERT INTO activity (report_id, activity_nbr, start_time, end_time, break, comment) VALUES (?, ?, ?, ?, ?, ?)" // WIP
|
const addTimeReport = "INSERT INTO activity (report_id, activity_nbr, start_time, end_time, break, comment) VALUES (?, ?, ?, ?, ?, ?)" // WIP
|
||||||
const addUserToProject = "INSERT INTO project_member (project_id, user_id, role) VALUES (?, ?, ?)" // WIP
|
const addUserToProject = "INSERT INTO project_member (project_id, user_id, role) VALUES (?, ?, ?)" // WIP
|
||||||
// const changeUserRole = ""
|
// const changeUserRole = ""
|
||||||
|
@ -66,14 +60,6 @@ func DbConnect(dbpath string) Database {
|
||||||
return &Db{db}
|
return &Db{db}
|
||||||
}
|
}
|
||||||
|
|
||||||
// func (d *Db) AddTimeReport(projectname string, start time.Time, end time.Time) error {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func (d *Db) AddUserToProject(username string, projectname string) error {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func (d *Db) ChangeUserRole(username string, projectname string, role string) error {
|
// func (d *Db) ChangeUserRole(username string, projectname string, role string) error {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
@ -121,11 +107,6 @@ func (d *Db) PromoteToAdmin(username string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Db) PromoteToAdmin(username string) error {
|
|
||||||
_, err := d.Exec(promoteToAdmin, username)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Db) GetUserId(username string) (int, error) {
|
func (d *Db) GetUserId(username string) (int, error) {
|
||||||
var id int
|
var id int
|
||||||
err := d.Get(&id, "SELECT id FROM users WHERE username = ?", username) // Borde det inte vara "user" i singular
|
err := d.Get(&id, "SELECT id FROM users WHERE username = ?", username) // Borde det inte vara "user" i singular
|
||||||
|
|
Loading…
Reference in a new issue