package resolvers import ( "context" "git.aiterp.net/rpdata/api/graph2/graphcore" "git.aiterp.net/rpdata/api/models" ) // Queries func (r *queryResolver) Post(ctx context.Context, id string) (*models.Post, error) { return r.s.Logs.FindPosts(ctx, id) } func (r *queryResolver) Posts(ctx context.Context, filter *models.PostFilter) ([]*models.Post, error) { return r.s.Logs.ListPosts(ctx, filter) } // Mutation func (r *mutationResolver) AddPost(ctx context.Context, input graphcore.PostAddInput) (*models.Post, error) { return r.s.Logs.AddPost(ctx, input.LogID, input.Time, input.Kind, input.Nick, input.Text) } func (r *mutationResolver) EditPost(ctx context.Context, input graphcore.PostEditInput) (*models.Post, error) { return r.s.Logs.EditPost(ctx, input.ID, models.PostUpdate{ Time: input.Time, Kind: input.Kind, Nick: input.Nick, Text: input.Text, }) } func (r *mutationResolver) MovePost(ctx context.Context, input graphcore.PostMoveInput) ([]*models.Post, error) { return r.s.Logs.MovePost(ctx, input.ID, input.ToPosition) } func (r *mutationResolver) RemovePost(ctx context.Context, input graphcore.PostRemoveInput) (*models.Post, error) { return r.s.Logs.DeletePost(ctx, input.ID) }