20 lines
445 B
Go
20 lines
445 B
Go
|
package task
|
||
|
|
||
|
import (
|
||
|
"git.tek.govt.hu/dowerx/szoe-pontok/database"
|
||
|
"git.tek.govt.hu/dowerx/szoe-pontok/model"
|
||
|
)
|
||
|
|
||
|
func Add(task model.Task) error {
|
||
|
db := database.GetDB()
|
||
|
|
||
|
_, err := db.NamedExec(
|
||
|
`insert into "task" ("description", "points", "recipient", "issuer") values
|
||
|
(:description, :points,
|
||
|
(select "id" from "user" where "neptun" = :recipient),
|
||
|
(select "id" from "user" where "neptun" = :issuer)
|
||
|
)`, task)
|
||
|
|
||
|
return err
|
||
|
}
|