app

package
v3.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package app is glabs-web's core: the layer the GraphQL resolvers delegate to, holding the database and enforcing that every request acts only as its own user. Resolvers stay thin — auth gate plus a call into here — so the rules live in one place rather than scattered across the schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(database *db.DB) *App

func (*App) Course added in v3.2.0

func (a *App) Course(ctx context.Context, name string) (*db.StoredCourse, error)

Course returns one of the caller's own courses.

func (*App) CourseLint added in v3.2.0

func (a *App) CourseLint(ctx context.Context, name string) ([]config.Finding, error)

CourseLint returns the lint findings for one of the caller's own courses.

func (*App) CourseYAML added in v3.2.0

func (a *App) CourseYAML(ctx context.Context, name string) ([]byte, error)

CourseYAML returns the course as a downloadable YAML file: the original bytes if they are still current, otherwise a re-encoding of the stored source.

func (*App) Courses added in v3.2.0

func (a *App) Courses(ctx context.Context) ([]*db.StoredCourse, error)

Courses returns the caller's own courses.

func (*App) DeleteCourse added in v3.2.0

func (a *App) DeleteCourse(ctx context.Context, name string) error

DeleteCourse removes one of the caller's own courses.

func (*App) GetUserByEmail

func (a *App) GetUserByEmail(ctx context.Context, email string) (*model.User, error)

GetUserByEmail looks up a user for the auth middleware's allowlist check.

func (*App) ImportCourseYAML added in v3.2.0

func (a *App) ImportCourseYAML(ctx context.Context, yaml string) (*db.StoredCourse, error)

ImportCourseYAML parses an uploaded course file and stores it for the caller, keeping the original bytes so a later download returns exactly what was uploaded. Importing a course whose name already exists replaces it.

An inline seeder signKey is rejected: it is a private key, and storing it would mean sealing it, hiding it in GraphQL, and excluding it from dumps — four leaks for a feature no course file uses. signKeyFile (a path) is fine.

func (*App) LocalDevUser

func (a *App) LocalDevUser() *model.User

LocalDevUser is the identity used when auth is disabled (local development). It is never consulted when auth is enabled.

func (*App) ServerInfo

func (a *App) ServerInfo() *model.ServerInfo

ServerInfo returns the build metadata main stashed in viper (ldflags at release, VCS info otherwise), so the GUI can show which build is running.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL