model

package
v3.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AssignmentView added in v3.4.0

type AssignmentView struct {
	Course string `json:"course"`
	Name   string `json:"name"`
	// The assignment this one inherits from, if any (`extends`).
	Extends *string `json:"extends,omitempty"`
	// Whether this is an abstract base (a template for `extends`).
	Abstract bool `json:"abstract"`
	// The assignment's own (source) field values, keyed by FieldMeta.key, for pre-filling the editor form.
	Own []*FieldValue `json:"own"`
	// The resolved config rendered as text (may contain ANSI); empty when resolveError is set.
	Resolved string `json:"resolved"`
	// Why the assignment could not be resolved (e.g. abstract base, missing parent) — not an error.
	ResolveError *string `json:"resolveError,omitempty"`
}

One assignment in source (own) form plus its resolved preview — the same rendering `glabs show` produces, so inheritance is visible.

type Course added in v3.2.0

type Course struct {
	Name         string `json:"name"`
	CoursePath   string `json:"coursePath"`
	SemesterPath string `json:"semesterPath"`
	// The names of the assignments in this course, sorted.
	AssignmentNames []string  `json:"assignmentNames"`
	StudentCount    int       `json:"studentCount"`
	GroupCount      int       `json:"groupCount"`
	ImportedAt      time.Time `json:"importedAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
}

A course as stored for the current user. Each user sees only their own courses; there is no way to reach another user's course.

type FieldKind added in v3.4.0

type FieldKind string

The input shape the GUI should render for a field.

const (
	FieldKindString     FieldKind = "STRING"
	FieldKindBool       FieldKind = "BOOL"
	FieldKindEnum       FieldKind = "ENUM"
	FieldKindInt        FieldKind = "INT"
	FieldKindStringlist FieldKind = "STRINGLIST"
)

func (FieldKind) IsValid added in v3.4.0

func (e FieldKind) IsValid() bool

func (FieldKind) MarshalGQL added in v3.4.0

func (e FieldKind) MarshalGQL(w io.Writer)

func (FieldKind) MarshalJSON added in v3.4.0

func (e FieldKind) MarshalJSON() ([]byte, error)

func (FieldKind) String added in v3.4.0

func (e FieldKind) String() string

func (*FieldKind) UnmarshalGQL added in v3.4.0

func (e *FieldKind) UnmarshalGQL(v any) error

func (*FieldKind) UnmarshalJSON added in v3.4.0

func (e *FieldKind) UnmarshalJSON(b []byte) error

type FieldMeta added in v3.4.0

type FieldMeta struct {
	// Config key, e.g. `per` or `accesslevel`.
	Key string `json:"key"`
	// Human-readable label for the form.
	Label string `json:"label"`
	// Short help text describing what the field does.
	Description string `json:"description"`
	// The input shape the GUI should render.
	Kind FieldKind `json:"kind"`
	// Whether the field must be set for a concrete (non-abstract) assignment.
	Required bool `json:"required"`
	// Whether the field is deprecated (shown but discouraged).
	Deprecated bool `json:"deprecated"`
	// An example value for the input placeholder, if any.
	Example *string `json:"example,omitempty"`
	// Dropdown options for an ENUM field (empty otherwise).
	Options []*FieldOption `json:"options"`
}

The assignment editor is schema-driven: the GUI renders a guided, validated form from this server-authoritative metadata, so labels, help text and dropdown options live in exactly one place.

type FieldOption added in v3.4.0

type FieldOption struct {
	Value       string `json:"value"`
	Label       string `json:"label"`
	Description string `json:"description"`
}

One choice of an ENUM field — a dropdown entry with its own short description.

type FieldValue added in v3.5.0

type FieldValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

One field's own (source) value for an assignment — what the user wrote, before inheritance. Values are stringified (booleans as `true`/`false`) and keyed by the same `key` as FieldMeta, so the GUI can pre-fill each schema field generically.

type FieldValueInput added in v3.6.0

type FieldValueInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

One field's drafted value, keyed by FieldMeta.key. Booleans as `true`/`false`; empty string unsets the field (so it inherits).

type Finding added in v3.2.0

type Finding struct {
	Path     string          `json:"path"`
	Message  string          `json:"message"`
	Severity FindingSeverity `json:"severity"`
}

One lint finding: configuration that does not do what it looks like it does.

type FindingSeverity added in v3.2.0

type FindingSeverity string
const (
	// The setting is present but has no effect.
	FindingSeverityProblem FindingSeverity = "PROBLEM"
	// It works, but the spelling or shape is obsolete.
	FindingSeverityDeprecated FindingSeverity = "DEPRECATED"
)

func (FindingSeverity) IsValid added in v3.2.0

func (e FindingSeverity) IsValid() bool

func (FindingSeverity) MarshalGQL added in v3.2.0

func (e FindingSeverity) MarshalGQL(w io.Writer)

func (FindingSeverity) MarshalJSON added in v3.2.0

func (e FindingSeverity) MarshalJSON() ([]byte, error)

func (FindingSeverity) String added in v3.2.0

func (e FindingSeverity) String() string

func (*FindingSeverity) UnmarshalGQL added in v3.2.0

func (e *FindingSeverity) UnmarshalGQL(v any) error

func (*FindingSeverity) UnmarshalJSON added in v3.2.0

func (e *FindingSeverity) UnmarshalJSON(b []byte) error

type GitLabTokenStatus added in v3.3.0

type GitLabTokenStatus struct {
	Set       bool       `json:"set"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
}

Whether the current user has stored a GitLab token, and when it was last set. The token itself is never returned by any query.

type Mutation added in v3.2.0

type Mutation struct {
}

type Query

type Query struct {
}

type ServerInfo

type ServerInfo struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
}

Version and build metadata for the running server.

type User

type User struct {
	Email string `json:"email" bson:"email"`
	Name  string `json:"name" bson:"name"`
}

User is an authenticated user of glabs-web. Identity comes from the auth proxy (the OIDC email); a user must be on the allowlist to be let in.

glabs has no role hierarchy — every user manages only their own courses (strict per-user isolation), so there is nothing for roles to gate. The type is written by hand rather than generated so it carries bson tags for MongoDB; gqlgen binds to it via autobind.

type ValidationResult added in v3.6.0

type ValidationResult struct {
	// Whether the draft is structurally sound and could be saved.
	Ok bool `json:"ok"`
	// Hard errors that make the draft unsaveable (empty when ok).
	Errors []string `json:"errors"`
	// The resolved config preview (Show() output, may contain ANSI) when the draft resolves.
	Resolved *string `json:"resolved,omitempty"`
	// Why there is no preview though the draft is ok — e.g. an abstract base.
	ResolveError *string `json:"resolveError,omitempty"`
}

Result of validating a draft assignment against the real resolver (the same one the CLI uses), without saving.

Jump to

Keyboard shortcuts

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