model

package
v3.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 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 AssignmentReport added in v3.16.0

type AssignmentReport struct {
	Course     string `json:"course"`
	Assignment string `json:"assignment"`
	// The assignment-level group URL.
	URL         string `json:"url"`
	Description string `json:"description"`
	// When the report was generated.
	Generated *time.Time `json:"generated,omitempty"`
	// Whether the assignment configures a release merge request (adds that column).
	HasReleaseMergeRequest bool `json:"hasReleaseMergeRequest"`
	// Whether the assignment configures release docker images (adds that column).
	HasReleaseDockerImages bool `json:"hasReleaseDockerImages"`
	// One entry per repository in the assignment's group, sorted by name.
	Projects []*ProjectReport `json:"projects"`
}

A live report over the repositories of one assignment — one row per project (repo) with activity, last commit, open issues/merge requests, members and an optional release status. Fetched from GitLab using the caller's stored token.

type AssignmentUrls added in v3.15.0

type AssignmentUrls struct {
	// Whether repos are per student or per group (`student` or `group`).
	Per string `json:"per"`
	// The assignment-level group URL, where all the repos live.
	GroupURL string `json:"groupUrl"`
	// One entry per student/group repository.
	Repos []*RepoURL `json:"repos"`
}

The repository URLs for one assignment: the assignment-level group URL plus one URL per student or per group. Read-only and derived purely from the resolved configuration — no GitLab token or API call is involved.

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"`
	// The names of the sibling assignments this one may inherit from — all assignments in the same course except this one (`extends` is course-internal). The valid choices for the editor's inheritance dropdown.
	ExtendsOptions []string `json:"extendsOptions"`
	// 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 CheckProgress added in v3.19.0

type CheckProgress struct {
	Message string       `json:"message"`
	Done    bool         `json:"done"`
	Result  *CheckResult `json:"result,omitempty"`
	Error   *string      `json:"error,omitempty"`
}

One event while a course check runs: a progress line as each entry is checked, or the single final event (done = true) carrying the result or an error.

type CheckResult added in v3.19.0

type CheckResult struct {
	Course string `json:"course"`
	// The course-level students, classified in configured order.
	Students []*StudentCheck `json:"students"`
	// The course's groups, each with its members classified.
	Groups []*GroupCheck `json:"groups"`
	// Students that appear in more than one group.
	Duplicates []*DuplicateCheck `json:"duplicates"`
	// Number of hard problems (unresolvable entries + duplicates).
	Errors int `json:"errors"`
	// Whether the whole course checks out (errors = 0).
	Ok bool `json:"ok"`
}

The result of checking a course's roster against GitLab: each roster entry classified, plus the students that appear in more than one group. Fetched with the caller's stored token.

type CommitReport added in v3.16.0

type CommitReport struct {
	Title         string     `json:"title"`
	CommitterName string     `json:"committerName"`
	CommittedDate *time.Time `json:"committedDate,omitempty"`
	WebURL        string     `json:"webUrl"`
}

The most recent commit across a repository's branches.

type Course added in v3.2.0

type Course struct {
	Name         string `json:"name"`
	CoursePath   string `json:"coursePath"`
	SemesterPath string `json:"semesterPath"`
	// Whether the course name is prepended to each project path.
	UseCoursenameAsPrefix bool `json:"useCoursenameAsPrefix"`
	// Whether the student's email domain is appended as a suffix (default true).
	UseEmailDomainAsSuffix bool `json:"useEmailDomainAsSuffix"`
	// The names of the assignments in this course, sorted.
	AssignmentNames []string `json:"assignmentNames"`
	// The course-level students (emails), as stored.
	Students []string `json:"students"`
	// The course-level groups, sorted by name.
	Groups       []*Group  `json:"groups"`
	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 DockerImageReport added in v3.16.0

type DockerImageReport struct {
	Wanted string  `json:"wanted"`
	Image  *string `json:"image,omitempty"`
}

type DockerImagesReport added in v3.16.0

type DockerImagesReport struct {
	Status string               `json:"status"`
	Images []*DockerImageReport `json:"images"`
}

type DuplicateCheck added in v3.19.0

type DuplicateCheck struct {
	Student string   `json:"student"`
	Groups  []string `json:"groups"`
}

One student that appears in more than one group.

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"`
	// Section this field belongs to (empty for the top-level group), e.g. `startercode`. Lets the GUI render grouped sections.
	Group string `json:"group"`
	// 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 Group added in v3.12.0

type Group struct {
	Name    string   `json:"name"`
	Members []string `json:"members"`
}

A named group of members (emails).

type GroupCheck added in v3.19.0

type GroupCheck struct {
	Name    string          `json:"name"`
	Members []*StudentCheck `json:"members"`
}

One group's members, classified.

type GroupInput added in v3.12.0

type GroupInput struct {
	Name    string   `json:"name"`
	Members []string `json:"members"`
}

A named group of members (emails), for setCourseGroups.

type LogLevel added in v3.21.0

type LogLevel string

The severity/kind of one streamed output line.

const (
	LogLevelInfo     LogLevel = "INFO"
	LogLevelWarn     LogLevel = "WARN"
	LogLevelError    LogLevel = "ERROR"
	LogLevelProgress LogLevel = "PROGRESS"
	LogLevelResult   LogLevel = "RESULT"
	LogLevelDone     LogLevel = "DONE"
)

func (LogLevel) IsValid added in v3.21.0

func (e LogLevel) IsValid() bool

func (LogLevel) MarshalGQL added in v3.21.0

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

func (LogLevel) MarshalJSON added in v3.21.0

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

func (LogLevel) String added in v3.21.0

func (e LogLevel) String() string

func (*LogLevel) UnmarshalGQL added in v3.21.0

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

func (*LogLevel) UnmarshalJSON added in v3.21.0

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

type LogLine added in v3.21.0

type LogLine struct {
	Level LogLevel `json:"level"`
	// The line text (ANSI stripped).
	Text string `json:"text"`
}

One line of a running operation's streamed output.

type Mutation added in v3.2.0

type Mutation struct {
}

type Op added in v3.20.0

type Op string

A mutating GitLab operation. None of them touch git — pure GitLab API calls.

const (
	OpSetaccess Op = "SETACCESS"
	OpProtect   Op = "PROTECT"
	OpArchive   Op = "ARCHIVE"
	OpDelete    Op = "DELETE"
)

func (Op) IsValid added in v3.20.0

func (e Op) IsValid() bool

func (Op) MarshalGQL added in v3.20.0

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

func (Op) MarshalJSON added in v3.20.0

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

func (Op) String added in v3.20.0

func (e Op) String() string

func (*Op) UnmarshalGQL added in v3.20.0

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

func (*Op) UnmarshalJSON added in v3.20.0

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

type OpParams added in v3.20.0

type OpParams struct {
	// setaccess: the access level to grant (guest|reporter|developer|maintainer).
	AccessLevel *string `json:"accessLevel,omitempty"`
	// protect: the branch to protect.
	Branch *string `json:"branch,omitempty"`
	// archive: unarchive instead of archive.
	Unarchive *bool `json:"unarchive,omitempty"`
}

Optional parameters for an operation (op-specific; unset fields fall back to the assignment config).

type OpPlan added in v3.20.0

type OpPlan struct {
	Op         Op     `json:"op"`
	Course     string `json:"course"`
	Assignment string `json:"assignment"`
	// The resolved config, exactly as `glabs show` renders it (may contain ANSI).
	Resolved string           `json:"resolved"`
	Targets  []*PlannedTarget `json:"targets"`
	Warnings []string         `json:"warnings"`
	// Whether the operation is destructive (archive/delete) and needs the confirm phrase.
	Destructive bool `json:"destructive"`
	// For destructive ops: the phrase the user must type to confirm (the assignment path).
	ConfirmPhrase *string `json:"confirmPhrase,omitempty"`
	// Opaque, single-use confirm token to pass to runOp/scheduleOp.
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expiresAt"`
}

The preview of a mutating operation before it runs: the resolved config, the repositories it would touch, warnings, and an opaque confirm token (5 min TTL) that carries a hash of the resolved config — so runOp can reject a plan whose config changed underneath it.

type PlannedTarget added in v3.20.0

type PlannedTarget struct {
	// The student's email (or username/id) or the group's name.
	For string `json:"for"`
	// The repository's project name.
	Repo string `json:"repo"`
	// The full web URL of the repository.
	URL string `json:"url"`
}

One repository an operation would touch.

type ProjectMemberReport added in v3.16.0

type ProjectMemberReport struct {
	Name     string `json:"name"`
	Username string `json:"username"`
	WebURL   string `json:"webUrl"`
}

A member of a repository (only the display fields, never GitLab-internal ids).

type ProjectReport added in v3.16.0

type ProjectReport struct {
	Name string `json:"name"`
	// Whether there was any activity beyond creation (or any commits).
	Active                 bool                   `json:"active"`
	EmptyRepo              bool                   `json:"emptyRepo"`
	Commits                int                    `json:"commits"`
	CreatedAt              *time.Time             `json:"createdAt,omitempty"`
	LastActivity           *time.Time             `json:"lastActivity,omitempty"`
	LastCommit             *CommitReport          `json:"lastCommit,omitempty"`
	OpenIssuesCount        int                    `json:"openIssuesCount"`
	OpenMergeRequestsCount int                    `json:"openMergeRequestsCount"`
	WebURL                 string                 `json:"webUrl"`
	Members                []*ProjectMemberReport `json:"members"`
	Release                *ReleaseReport         `json:"release,omitempty"`
}

The report for one repository.

type Query

type Query struct {
}

type ReleaseMergeRequestReport added in v3.16.0

type ReleaseMergeRequestReport struct {
	Found          bool   `json:"found"`
	WebURL         string `json:"webUrl"`
	PipelineStatus string `json:"pipelineStatus"`
}

type ReleaseReport added in v3.16.0

type ReleaseReport struct {
	MergeRequest *ReleaseMergeRequestReport `json:"mergeRequest,omitempty"`
	DockerImages *DockerImagesReport        `json:"dockerImages,omitempty"`
}

The release status of a repository, when the assignment configures a release.

type RepoURL added in v3.15.0

type RepoURL struct {
	// The student's email (or username/id fallback) or the group's name.
	For string `json:"for"`
	// The full web URL of the repository.
	URL string `json:"url"`
}

One repository URL together with who it belongs to.

type ReportProgress added in v3.18.0

type ReportProgress struct {
	// A human-readable progress line; empty on the final event.
	Message string `json:"message"`
	// True on the final event; then no more events follow.
	Done bool `json:"done"`
	// The finished report — set only on the final event, and only if it succeeded.
	Report *AssignmentReport `json:"report,omitempty"`
	// Why generation failed — set only on the final event on failure.
	Error *string `json:"error,omitempty"`
}

One event while a report is being generated: a progress line as it is fetched, or the single final event (done = true) carrying the finished report or an error.

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 StudentCheck added in v3.19.0

type StudentCheck struct {
	// The raw roster entry, as written.
	Input  string             `json:"input"`
	Status StudentCheckStatus `json:"status"`
	// Human-readable detail (the resolved user, or why it failed).
	Message string `json:"message"`
}

One roster entry classified against GitLab.

type StudentCheckStatus added in v3.19.0

type StudentCheckStatus string

How a roster entry resolved against GitLab.

const (
	// Resolved (pinned by ID, or matched uniquely by email).
	StudentCheckStatusOk StudentCheckStatus = "OK"
	// No GitLab user yet, but there is an email → will be invited.
	StudentCheckStatusInvite StudentCheckStatus = "INVITE"
	// Resolved by username — works, but pinning by ID is safer.
	StudentCheckStatusDeprecated StudentCheckStatus = "DEPRECATED"
	// Cannot resolve and there is no email to fall back to.
	StudentCheckStatusError StudentCheckStatus = "ERROR"
)

func (StudentCheckStatus) IsValid added in v3.19.0

func (e StudentCheckStatus) IsValid() bool

func (StudentCheckStatus) MarshalGQL added in v3.19.0

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

func (StudentCheckStatus) MarshalJSON added in v3.19.0

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

func (StudentCheckStatus) String added in v3.19.0

func (e StudentCheckStatus) String() string

func (*StudentCheckStatus) UnmarshalGQL added in v3.19.0

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

func (*StudentCheckStatus) UnmarshalJSON added in v3.19.0

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

type Subscription added in v3.18.0

type Subscription struct {
}

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