models

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contribution

type Contribution struct {
	ID       string `bson:"_id" json:"id" jsonapi:"primary,contribution"`
	PersonId string `bson:"person_id" json:"person_id" jsonapi:"relation,person"`
	VolumeId string `bson:"volume_id" json:"volume_id" jsonapi:"relation,volume"`
	Role     string `bson:"role" json:"role" jsonapi:"attr,role"`
	Notes    string `json:"notes" jsonapi:"attr,notes"`
	modelcore.Auditable
}

Contribution model. This model represents the association of a person to a volume.

type EntityMeta added in v0.4.0

type EntityMeta struct {
	ID             string     `bson:"_id" json:"id"`
	CurrentVersion int        `bson:"current_version" json:"current_version"`
	CreatedAt      time.Time  `bson:"created_at" json:"created_at"`
	CreatedBy      string     `bson:"created_by" json:"created_by"`
	UpdatedAt      time.Time  `bson:"updated_at" json:"updated_at"`
	UpdatedBy      string     `bson:"updated_by" json:"updated_by"`
	DeletedAt      *time.Time `bson:"deleted_at,omitempty" json:"deleted_at,omitempty"`
	DeletedBy      *string    `bson:"deleted_by,omitempty" json:"deleted_by,omitempty"`
}

EntityMeta is the stable-identity record shared by every versioned entity type introduced by this change (publisher, studio, person, license, system): its id, the version currently live, and creation/deletion audit. Its shape never varies by type, so it's reused directly rather than duplicated per type - unlike VolumeMeta, which predates this shared type and stays as its own struct rather than being reshaped after shipping.

type License

type License struct {
	ID           string               `bson:"_id" json:"id" jsonapi:"primary,license"`
	Title        string               `json:"title" jsonapi:"attr,title"`
	ShortTitle   string               `bson:"short_title" json:"short_title" jsonapi:"attr,short_title"`
	Version      string               `json:"version" jsonapi:"attr,version"`
	Deed         string               `json:"deed" jsonapi:"attr,deed"`
	LegalCode    string               `bson:"legal_code" json:"legal_code" jsonapi:"attr,legal_code"`
	Website      url.URL              `json:"website" jsonapi:"attr,website"`
	Status       string               `json:"status" jsonapi:"attr,status"`
	Availability string               `json:"availability" jsonapi:"attr,availability"`
	Notes        string               `json:"notes" jsonapi:"attr,notes"`
	Properties   []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags         []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	modelcore.Auditable
}

License model. This model represents the license information for any given RPG resource.

type LicenseVersion added in v0.4.0

type LicenseVersion struct {
	ID               string               `bson:"_id" json:"id" jsonapi:"primary,license_version"`
	RecordID         string               `bson:"record_id" json:"record_id" jsonapi:"attr,record_id"`
	Version          int                  `bson:"version" json:"version" jsonapi:"attr,version"`
	Title            string               `json:"title" jsonapi:"attr,title"`
	ShortTitle       string               `bson:"short_title" json:"short_title" jsonapi:"attr,short_title"`
	LicenseVer       string               `bson:"version_label" json:"version_label" jsonapi:"attr,version_label"`
	Deed             string               `json:"deed" jsonapi:"attr,deed"`
	LegalCode        string               `bson:"legal_code" json:"legal_code" jsonapi:"attr,legal_code"`
	Website          url.URL              `json:"website" jsonapi:"attr,website"`
	Status           string               `json:"status" jsonapi:"attr,status"`
	Availability     string               `json:"availability" jsonapi:"attr,availability"`
	Notes            string               `json:"notes" jsonapi:"attr,notes"`
	Properties       []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags             []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	VersionLifecycle `bson:",inline"`
}

LicenseVersion model. One full-snapshot version of a license's substantive fields, plus the shared submission/review audit trail (VersionLifecycle).

type Person

type Person struct {
	ID         string               `bson:"_id" json:"id" jsonapi:"primary,person"`
	Name       string               `json:"name" jsonapi:"attr,name"`
	Notes      string               `json:"notes" jsonapi:"attr,notes"`
	Properties []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags       []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	modelcore.Auditable
}

Person model. This model represents a person involved in the production of an RPG resource.

type PersonVersion added in v0.4.0

type PersonVersion struct {
	ID               string               `bson:"_id" json:"id" jsonapi:"primary,person_version"`
	RecordID         string               `bson:"record_id" json:"record_id" jsonapi:"attr,record_id"`
	Version          int                  `bson:"version" json:"version" jsonapi:"attr,version"`
	Name             string               `json:"name" jsonapi:"attr,name"`
	Notes            string               `json:"notes" jsonapi:"attr,notes"`
	Properties       []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags             []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	VersionLifecycle `bson:",inline"`
}

PersonVersion model. One full-snapshot version of a person's substantive fields, plus the shared submission/review audit trail (VersionLifecycle).

type Publisher

type Publisher struct {
	ID         string               `bson:"_id" json:"id" jsonapi:"primary,publisher"`
	Name       string               `json:"name" jsonapi:"attr,name"`
	Address    string               `json:"address" jsonapi:"attr,address"`
	Website    url.URL              `json:"website" jsonapi:"attr,website"`
	Notes      string               `json:"notes" jsonapi:"attr,notes"`
	Properties []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags       []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	modelcore.Auditable
}

Publisher model. This model represents a publisher involved in the production of an RPG resource.

type PublisherVersion added in v0.4.0

type PublisherVersion struct {
	ID               string               `bson:"_id" json:"id" jsonapi:"primary,publisher_version"`
	RecordID         string               `bson:"record_id" json:"record_id" jsonapi:"attr,record_id"`
	Version          int                  `bson:"version" json:"version" jsonapi:"attr,version"`
	Name             string               `json:"name" jsonapi:"attr,name"`
	Address          string               `json:"address" jsonapi:"attr,address"`
	Website          url.URL              `json:"website" jsonapi:"attr,website"`
	Notes            string               `json:"notes" jsonapi:"attr,notes"`
	Properties       []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags             []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	VersionLifecycle `bson:",inline"`
}

PublisherVersion model. One full-snapshot version of a publisher's substantive fields, plus the shared submission/ review audit trail (VersionLifecycle).

type Review

type Review struct {
	ID       string          `bson:"_id" json:"id" jsonapi:"primary,review"`
	Title    string          `json:"title" jsonapi:"attr,title"`
	Body     string          `bson:"body" json:"body" jsonapi:"attr,body"`
	Language string          `json:"language" jsonapi:"attr,language"`
	VolumeId string          `bson:"volume_id" json:"volume_id" jsonapi:"relation,volume"`
	Notes    string          `json:"notes" jsonapi:"attr,notes"`
	Tags     []modelcore.Tag `json:"tags" jsonapi:"attr,tags"`
	modelcore.Auditable
}

Review model. This model represents a review on an RPG resource.

type Studio

type Studio struct {
	ID         string               `bson:"_id" json:"id" jsonapi:"primary,studio"`
	Name       string               `json:"name" jsonapi:"attr,name"`
	Website    url.URL              `json:"website" jsonapi:"attr,website"`
	Notes      string               `json:"notes" jsonapi:"attr,notes"`
	Properties []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags       []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	modelcore.Auditable
}

Studio model. This model represents a studio that can produce an RPG resource.

type StudioVersion added in v0.4.0

type StudioVersion struct {
	ID               string               `bson:"_id" json:"id" jsonapi:"primary,studio_version"`
	RecordID         string               `bson:"record_id" json:"record_id" jsonapi:"attr,record_id"`
	Version          int                  `bson:"version" json:"version" jsonapi:"attr,version"`
	Name             string               `json:"name" jsonapi:"attr,name"`
	Website          url.URL              `json:"website" jsonapi:"attr,website"`
	Notes            string               `json:"notes" jsonapi:"attr,notes"`
	Properties       []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags             []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	VersionLifecycle `bson:",inline"`
}

StudioVersion model. One full-snapshot version of a studio's substantive fields, plus the shared submission/review audit trail (VersionLifecycle).

type System

type System struct {
	ID         string          `bson:"_id" json:"id" jsonapi:"primary,system"`
	GameSystem string          `bson:"game_system" json:"game_system" jsonapi:"attr,game_system"`
	Edition    string          `bson:"edition" json:"edition" jsonapi:"attr,edition"`
	Notes      string          `json:"notes" jsonapi:"attr,notes"`
	Tags       []modelcore.Tag `json:"tags" jsonapi:"attr,tags"`
	modelcore.Auditable
}

System model. This model represents a game system that RPG resources can be associated with.

type SystemVersion added in v0.4.0

type SystemVersion struct {
	ID               string          `bson:"_id" json:"id" jsonapi:"primary,system_version"`
	RecordID         string          `bson:"record_id" json:"record_id" jsonapi:"attr,record_id"`
	Version          int             `bson:"version" json:"version" jsonapi:"attr,version"`
	GameSystem       string          `bson:"game_system" json:"game_system" jsonapi:"attr,game_system"`
	Edition          string          `bson:"edition" json:"edition" jsonapi:"attr,edition"`
	Notes            string          `json:"notes" jsonapi:"attr,notes"`
	Tags             []modelcore.Tag `json:"tags" jsonapi:"attr,tags"`
	VersionLifecycle `bson:",inline"`
}

SystemVersion model. One full-snapshot version of a system's substantive fields, plus the shared submission/review audit trail (VersionLifecycle).

type VersionLifecycle added in v0.4.0

type VersionLifecycle struct {
	State            VersionState `bson:"state" json:"state" jsonapi:"attr,state"`
	BaseVersion      *int         `bson:"base_version,omitempty" json:"base_version" jsonapi:"attr,base_version,omitempty"`
	SubmittedBy      string       `bson:"submitted_by" json:"submitted_by" jsonapi:"attr,submitted_by"`
	SubmittedAt      time.Time    `bson:"submitted_at" json:"submitted_at" jsonapi:"attr,submitted_at"`
	ReviewedBy       *string      `bson:"reviewed_by,omitempty" json:"reviewed_by" jsonapi:"attr,reviewed_by,omitempty"`
	ReviewedAt       *time.Time   `bson:"reviewed_at,omitempty" json:"reviewed_at" jsonapi:"attr,reviewed_at,omitempty"`
	ReviewNote       *string      `bson:"review_note,omitempty" json:"review_note" jsonapi:"attr,review_note,omitempty"`
	ResultingVersion *int         `bson:"resulting_version,omitempty" json:"resulting_version" jsonapi:"attr,resulting_version,omitempty"`
}

VersionLifecycle is the submission/review audit trail shared by every versioned entity type's version record - state, provenance, and review outcome. Embedded into each type's own Version struct (PublisherVersion, StudioVersion, ...) alongside that type's substantive fields, the same way modelcore.Auditable is embedded into every entity model. VolumeVersion predates this type and carries the same fields inline rather than via embedding - not worth reshaping already-shipped, tested code to match.

type VersionState added in v0.3.0

type VersionState string

VersionState is the lifecycle state of a version record, shared across every versioned entity type (volume, publisher, studio, person, license, system).

const (
	VersionStateSubmitted         VersionState = "submitted"
	VersionStateLive              VersionState = "live"
	VersionStateArchived          VersionState = "archived"
	VersionStateRejected          VersionState = "rejected"
	VersionStatePartiallyAccepted VersionState = "partially_accepted"
	VersionStateWithdrawn         VersionState = "withdrawn"
)

type Volume

type Volume struct {
	ID             string   `bson:"_id" json:"id" jsonapi:"primary,volume"`
	Title          string   `json:"title" jsonapi:"attr,title"`
	Description    string   `bson:"description" json:"description" jsonapi:"attr,description"`
	Notes          string   `json:"notes" jsonapi:"attr,notes"`
	Format         string   `bson:"format" json:"format" jsonapi:"attr,format"`
	CoverAssetId   string   `bson:"cover_asset_id" json:"cover_asset_id" jsonapi:"attr,coverAssetId"`
	SampleAssetIds []string `bson:"sample_asset_ids" json:"sample_asset_ids" jsonapi:"attr,sampleAssetIds"`
	SystemIds      []string `bson:"system_ids" json:"system_ids" jsonapi:"relation,system"`
	// SystemTitles: denormalized system display names keyed by system ID, parallel to SystemIds.
	// Captured at write time so reads render the name without a game-systems-api call; nil is
	// valid (renders the ID).
	SystemTitles map[string]string    `bson:"system_titles,omitempty" json:"system_titles,omitempty"`
	PublisherIds []string             `bson:"publisher_ids" json:"publisher_ids" jsonapi:"relation,publisher"`
	StudioIds    []string             `bson:"studio_ids" json:"studio_ids" jsonapi:"relation,studio"`
	LicenseIds   []string             `bson:"license_ids" json:"license_ids" jsonapi:"relation,license"`
	Properties   []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags         []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`
	modelcore.Auditable
}

Volume model. This model represents an RPG volume.

type VolumeMeta added in v0.3.0

type VolumeMeta struct {
	ID             string     `bson:"_id" json:"id" jsonapi:"primary,volume_meta"`
	CurrentVersion int        `bson:"current_version" json:"current_version" jsonapi:"attr,current_version"`
	CreatedAt      time.Time  `bson:"created_at" json:"created_at" jsonapi:"attr,created_at"`
	CreatedBy      string     `bson:"created_by" json:"created_by" jsonapi:"attr,created_by"`
	UpdatedAt      time.Time  `bson:"updated_at" json:"updated_at" jsonapi:"attr,updated_at"`
	UpdatedBy      string     `bson:"updated_by" json:"updated_by" jsonapi:"attr,updated_by"`
	DeletedAt      *time.Time `bson:"deleted_at,omitempty" json:"deleted_at" jsonapi:"attr,deleted_at,omitempty"`
	DeletedBy      *string    `bson:"deleted_by,omitempty" json:"deleted_by" jsonapi:"attr,deleted_by,omitempty"`
}

VolumeMeta model. This model represents the stable identity of a volume record: its id, the version currently live, and creation/deletion audit. The record's substantive fields live on VolumeVersion.

type VolumeVersion added in v0.3.0

type VolumeVersion struct {
	ID             string   `bson:"_id" json:"id" jsonapi:"primary,volume_version"`
	RecordID       string   `bson:"record_id" json:"record_id" jsonapi:"attr,record_id"`
	Version        int      `bson:"version" json:"version" jsonapi:"attr,version"`
	Title          string   `json:"title" jsonapi:"attr,title"`
	Description    string   `bson:"description" json:"description" jsonapi:"attr,description"`
	Notes          string   `json:"notes" jsonapi:"attr,notes"`
	Format         string   `bson:"format" json:"format" jsonapi:"attr,format"`
	CoverAssetId   string   `bson:"cover_asset_id" json:"cover_asset_id" jsonapi:"attr,coverAssetId"`
	SampleAssetIds []string `bson:"sample_asset_ids" json:"sample_asset_ids" jsonapi:"attr,sampleAssetIds"`
	// StagedCoverAssetId/StagedSampleAssetIds hold not-yet-promoted edit-session asset uploads
	// on a submitted version - see design.md's "Staged edit-session assets ride on the submitted
	// version as separate staged fields". CoverAssetId/SampleAssetIds above stay at their current
	// live values until promotion happens at accept time.
	StagedCoverAssetId   *string  `bson:"staged_cover_asset_id,omitempty" json:"staged_cover_asset_id,omitempty" jsonapi:"attr,staged_cover_asset_id,omitempty"`
	StagedSampleAssetIds []string `` /* 130-byte string literal not displayed */
	SystemIds            []string `bson:"system_ids" json:"system_ids" jsonapi:"relation,system"`
	// SystemTitles is a denormalized snapshot of each referenced system's display name, keyed by
	// system ID, captured at write time so volume reads render the system name without a
	// game-systems-api call. Parallel to SystemIds; a nil/absent map is valid (renders the ID).
	SystemTitles map[string]string    `bson:"system_titles,omitempty" json:"system_titles,omitempty"`
	PublisherIds []string             `bson:"publisher_ids" json:"publisher_ids" jsonapi:"relation,publisher"`
	StudioIds    []string             `bson:"studio_ids" json:"studio_ids" jsonapi:"relation,studio"`
	LicenseIds   []string             `bson:"license_ids" json:"license_ids" jsonapi:"relation,license"`
	Properties   []modelcore.Property `json:"properties" jsonapi:"attr,properties"`
	Tags         []modelcore.Tag      `json:"tags" jsonapi:"attr,tags"`

	State            VersionState `bson:"state" json:"state" jsonapi:"attr,state"`
	BaseVersion      *int         `bson:"base_version,omitempty" json:"base_version" jsonapi:"attr,base_version,omitempty"`
	SubmittedBy      string       `bson:"submitted_by" json:"submitted_by" jsonapi:"attr,submitted_by"`
	SubmittedAt      time.Time    `bson:"submitted_at" json:"submitted_at" jsonapi:"attr,submitted_at"`
	ReviewedBy       *string      `bson:"reviewed_by,omitempty" json:"reviewed_by" jsonapi:"attr,reviewed_by,omitempty"`
	ReviewedAt       *time.Time   `bson:"reviewed_at,omitempty" json:"reviewed_at" jsonapi:"attr,reviewed_at,omitempty"`
	ReviewNote       *string      `bson:"review_note,omitempty" json:"review_note" jsonapi:"attr,review_note,omitempty"`
	ResultingVersion *int         `bson:"resulting_version,omitempty" json:"resulting_version" jsonapi:"attr,resulting_version,omitempty"`
}

VolumeVersion model. This model represents one full-snapshot version of a volume's substantive fields, plus the submission/review audit trail that moves it through the version lifecycle (see VersionState).

Jump to

Keyboard shortcuts

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