first draft of AddTimeReport in db.go
This commit is contained in:
parent
7ed986e4eb
commit
5a85f2bf81
2 changed files with 7 additions and 23 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
|
@ -36,7 +37,8 @@ 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 addTimeReport = "INSERT INTO activity (report_id, activity_nbr, start_time, end_time, break, comment) VALUES (?, ?, ?, ?, ?, ?)"
|
||||||
|
|
||||||
// const addUserToProject = ""
|
// const addUserToProject = ""
|
||||||
// const changeUserRole = ""
|
// const changeUserRole = ""
|
||||||
|
|
||||||
|
@ -57,9 +59,10 @@ 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) AddTimeReport(projectname string, start time.Time, end time.Time, breakTime uint32) error { // WIP
|
||||||
|
_, err := d.Exec(addTimeReport, projectname, 0, start, end, breakTime, false)
|
||||||
// }
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// func (d *Db) AddUserToProject(username string, projectname string) error {
|
// func (d *Db) AddUserToProject(username string, projectname string) error {
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package model
|
|
||||||
|
|
||||||
type TimeReport struct {
|
|
||||||
reportId string
|
|
||||||
projectName string
|
|
||||||
userName string
|
|
||||||
userRole string
|
|
||||||
reportDate string
|
|
||||||
timeWorked uint64
|
|
||||||
isSigned bool
|
|
||||||
reportStatus string // Example "draft", "signed", "unsigned"
|
|
||||||
}
|
|
||||||
|
|
||||||
type Project struct {
|
|
||||||
timeReports []TimeReport
|
|
||||||
projectName string
|
|
||||||
projectmembers map[string]User
|
|
||||||
projectRoles map[string]User
|
|
||||||
}
|
|
Loading…
Reference in a new issue