szoe-pontok/database/task/task.go
2024-10-10 23:06:50 +02:00

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
}