-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
wiki.resolvers.go
55 lines (43 loc) · 1.37 KB
/
wiki.resolvers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package graphql
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.41
import (
"context"
)
// InsertLog is the resolver for the insertLog field.
func (r *mutationResolver) InsertLog(ctx context.Context, input NewLog) (*Log, error) {
l := &Log{
Project: input.Project,
Started: input.Started,
Stopped: input.Stopped,
Sector: input.Sector,
}
u := GetUserFromContext(ctx)
if u != nil {
l.User = *u
}
if input.Description != nil {
l.Description = *input.Description
}
if err := l.Save(ctx); err != nil {
return nil, err
}
return l, nil
}
// Logs is the resolver for the logs field.
func (r *queryResolver) Logs(ctx context.Context, input *Limit) ([]*Log, error) {
u := GetUserFromContext(ctx)
limit, offset := ParseLimit(input, 25, 0)
return UserLogs(ctx, u, limit, offset)
}
// Log is the resolver for the log field.
func (r *queryResolver) Log(ctx context.Context, id string) (*Log, error) {
return GetLog(ctx, id)
}
// Photos is the resolver for the photos field.
func (r *queryResolver) Photos(ctx context.Context, input *Limit) ([]*Photo, error) {
u := GetUserFromContext(ctx)
limit, offset := ParseLimit(input, 25, 0)
return UserPhotos(ctx, u, limit, offset)
}