snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s

This commit is contained in:
upstream-mirror
2026-09-16 05:24:45 +05:00
commit cda7c1a474
272 changed files with 31973 additions and 0 deletions

21
timespan/copy.go Normal file
View File

@@ -0,0 +1,21 @@
package timespan
import (
"context"
"fmt"
"github.com/traggo/server/auth"
"github.com/traggo/server/generated/gqlmodel"
"github.com/traggo/server/model"
)
// CopyTimeSpan copies a time span.
func (r *ResolverForTimeSpan) CopyTimeSpan(ctx context.Context, id int, start model.Time, end *model.Time) (*gqlmodel.TimeSpan, error) {
old := &model.TimeSpan{ID: id}
if r.DB.Preload("Tags").Where("user_id = ?", auth.GetUser(ctx).ID).Find(old).RecordNotFound() {
return nil, fmt.Errorf("time span with id %d does not exist", id)
}
return r.CreateTimeSpan(ctx, start, end, tagsToInputTag(old.Tags), old.Note)
}