Files
stpweb/backend/graph/message.resolvers.go
T
adamfandClaude Opus 5.5 aa4c3b1a67
Test and deploy / test (push) Successful in 58s
Test and deploy / deploy (push) Successful in 3m4s
Finish the Renovate batch: go.sum, gqlgen regen, lockfile, katex hold
The Renovate branches changed go.mod and package.json without go.sum or
package-lock.json, so this tidies the module graph, regenerates the gqlgen
code for v0.17.98 and refreshes the lockfile.

katex stays on 0.16: @mdit/plugin-katex renders with its own katex ^0.16
and Markdown.vue loads only the stylesheet from the top-level package, so
0.19's CSS would no longer match the rendered HTML. renovate.json5 now caps
it below 0.17 so the bump is not proposed again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 15:14:21 +00:00

45 lines
1.5 KiB
Go

package graph
// 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.98
import (
"context"
"adam-french.co.uk/backend/models"
)
// AuthorID is the resolver for the authorId field.
// AuthorID is the resolver for the authorId field. The value is the chat
// hub's per-connection counter, not a User id — see models.Message.
func (r *messageResolver) AuthorID(ctx context.Context, obj *models.Message) (int, error) {
return int(obj.AuthorID), nil
}
// Messages is the resolver for the messages field.
func (r *queryResolver) Messages(ctx context.Context) ([]*models.Message, error) {
// Non-admins get the public subset rather than an error, so the chat
// history loads for everyone. The same filter is applied to the history
// replayed over the WebSocket (services.HandleWebSocket) — change one and
// the other must change too.
//
// Note the ordering differs between the two: newest first here, oldest
// first over the socket.
var messages []models.Message
query := r.Store.DB.Order("created_at DESC")
if !IsAdminFromCtx(ctx) {
query = query.Where("private = ?", false)
}
if err := query.Find(&messages).Error; err != nil {
return nil, err
}
return ptrs(messages), nil
}
// Message returns MessageResolver implementation.
func (r *Resolver) Message() MessageResolver { return &messageResolver{r} }
type messageResolver struct{ *Resolver }