Merge branch 'dev' into BumBranch
This commit is contained in:
commit
502cd67b4c
1 changed files with 12 additions and 1 deletions
|
@ -201,7 +201,18 @@ func (d *Db) GetProjectId(projectname string) (int, error) {
|
||||||
|
|
||||||
// Creates a new project in the database, associated with a user
|
// Creates a new project in the database, associated with a user
|
||||||
func (d *Db) AddProject(name string, description string, username string) error {
|
func (d *Db) AddProject(name string, description string, username string) error {
|
||||||
_, err := d.Exec(projectInsert, name, description, username)
|
tx := d.MustBegin()
|
||||||
|
_, err := tx.Exec(projectInsert, name, description, username)
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = tx.Exec(changeUserRole, "project_manager", username, name)
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
tx.Commit()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue