2024-02-18 21:37:17 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"code.tjo.space/mentos1386/zdravko/internal/models"
|
|
|
|
"code.tjo.space/mentos1386/zdravko/internal/models/query"
|
|
|
|
)
|
|
|
|
|
2024-02-23 21:08:17 +00:00
|
|
|
func CreateWorker(ctx context.Context, q *query.Query, worker *models.Worker) error {
|
|
|
|
return q.Worker.WithContext(ctx).Create(worker)
|
2024-02-18 21:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetWorker(ctx context.Context, q *query.Query, slug string) (*models.Worker, error) {
|
|
|
|
log.Println("GetWorker")
|
|
|
|
return q.Worker.WithContext(ctx).Where(
|
|
|
|
q.Worker.Slug.Eq(slug),
|
|
|
|
).First()
|
|
|
|
}
|