Documentation ¶
Index ¶
- Variables
- func NewRawID() string
- type Assignment
- type AssignmentKind
- type Attachment
- type Comment
- type Document
- type HealthCheckComponent
- type HealthStatus
- type ID
- type Issue
- type IssueKind
- type IssuePriority
- type IssueRelation
- type IssueRelationKind
- type IssueResolution
- type IssueStatus
- type Label
- type Language
- type Namespace
- type Notification
- type Organization
- type OrganizationStatus
- type Permission
- type PermissionKind
- type Project
- type ProjectStatus
- type ResourceType
- type Role
- type SystemRole
- type Todo
- type TodoPriority
- type User
- type UserStatus
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidAssignmentDetails = errors.New("invalid assignment details") // the assignment details are invalid ErrInvalidAssignmentKind = errors.New("invalid assigned to kind") // the assigned to kind is invalid ErrInvalidAttachmentDetails = errors.New("invalid attachment details") // the attachment details are invalid ErrInvalidCommentDetails = errors.New("invalid comment details") // the comment details are invalid ErrInvalidDocumentDetails = errors.New("invalid document details") // the document details are invalid ErrInvalidHealthStatus = errors.New("invalid health status") // health status is invalid ErrInvalidID = errors.New("invalid id") // the id is invalid ErrInvalidIssueDetails = errors.New("invalid issue details") // the issue details are invalid ErrInvalidIssueKind = errors.New("invalid issue kind") // the issue kind is invalid ErrInvalidIssuePriority = errors.New("invalid issue priority") // the issue priority is invalid ErrInvalidIssueRelationDetails = errors.New("invalid issue relation details") // the issue relation details are invalid ErrInvalidIssueRelationKind = errors.New("invalid issue relation kind") // the issue relation kind is invalid ErrInvalidIssueResolution = errors.New("invalid issue resolution") // the issue resolution is invalid ErrInvalidIssueStatus = errors.New("invalid issue status") // the issue status is invalid ErrInvalidLabelDetails = errors.New("invalid Type details") // the Type details are invalid ErrInvalidLanguage = errors.New("invalid language code") // Language is not valid ErrInvalidNamespaceDetails = errors.New("invalid namespace details") // the namespace details are invalid ErrInvalidNotificationDetails = errors.New("invalid notification details") // the notification details are invalid ErrInvalidNotificationRecipient = errors.New("invalid notification recipient") // the notification recipient is invalid ErrInvalidOrganizationDetails = errors.New("invalid organization details") // the organization details are invalid ErrInvalidOrganizationStatus = errors.New("invalid organization status") // the organization status is invalid ErrInvalidPermissionDetails = errors.New("invalid permission details") // the permission details are invalid ErrInvalidPermissionKind = errors.New("invalid permission kind") // the permission kind is invalid ErrInvalidProjectDetails = errors.New("invalid project details") // the project details are invalid ErrInvalidProjectStatus = errors.New("invalid project status") // the project status is invalid ErrInvalidResourceType = errors.New("invalid resource type") // the resource type is invalid ErrInvalidRoleDetails = errors.New("invalid role details") // the role details are invalid ErrInvalidSystemRole = errors.New("invalid system role") // the system role is invalid ErrInvalidTodoDetails = errors.New("invalid todo details") // the todo details are invalid ErrInvalidTodoPriority = errors.New("invalid todo priority") // the todo priority is invalid ErrInvalidUserDetails = errors.New("invalid user details") // the user details are invalid ErrInvalidUserStatus = errors.New("invalid user status") // the user status is invalid ErrPermissionSubjectTargetEqual = errors.New("permission subject and target are equal") // the permission subject and target are equal )
Functions ¶
Types ¶
type Assignment ¶
type Assignment struct { ID ID `json:"id" validate:"required"` Kind AssignmentKind `json:"kind" validate:"required,min=1,max=2"` User ID `json:"user_id" validate:"required"` Resource ID `json:"resource_id" validate:"required"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` }
Assignment is the model of an assignment between a user and a resource.
func NewAssignment ¶
func NewAssignment(user, resource ID, kind AssignmentKind) (*Assignment, error)
NewAssignment creates a new assignment.
func (*Assignment) Validate ¶
func (a *Assignment) Validate() error
Validate validates the assignment details.
type AssignmentKind ¶
type AssignmentKind uint8
AssignmentKind is the kind of assignment between a user and a resource.
const ( AssignmentKindAssignee AssignmentKind = iota + 1 // a user is assigned as an assignee AssignmentKindReviewer // a user is assigned as a reviewer )
func (AssignmentKind) MarshalText ¶
func (k AssignmentKind) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (AssignmentKind) String ¶
func (k AssignmentKind) String() string
String returns the string representation of the relation kind.
func (*AssignmentKind) UnmarshalText ¶
func (k *AssignmentKind) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Attachment ¶
type Attachment struct { ID ID `json:"id" validate:"required"` Name string `json:"name" validate:"required,min=3,max=120"` FileID string `json:"file_id" validate:"required"` CreatedBy ID `json:"created_by" validate:"required"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Attachment represents an attachment on a resource.
func NewAttachment ¶
func NewAttachment(name, fileID string, createdBy ID) (*Attachment, error)
NewAttachment creates a new Attachment.
func (*Attachment) Validate ¶
func (c *Attachment) Validate() error
type Comment ¶
type Comment struct { ID ID `json:"id" validate:"required"` Content string `json:"content" validate:"required,min=5,max=2000"` CreatedBy ID `json:"created_by" validate:"required"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Comment represents a comment on a resource.
func NewComment ¶
NewComment creates a new Comment.
type Document ¶
type Document struct { ID ID `json:"id" validate:"required"` Name string `json:"name" validate:"required,min=3,max=120"` Excerpt string `json:"excerpt" validate:"omitempty,min=10,max=500"` FileID string `json:"file_id" validate:"required"` CreatedBy ID `json:"created_by" validate:"required"` Labels []ID `json:"labels" validate:"omitempty,dive"` Comments []ID `json:"comments" validate:"omitempty,dive"` Attachments []ID `json:"attachments" validate:"omitempty,dive"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Document represents a document in the system that can be associated with a model.Organization, model.Namespace, model.Project, or User. A document is a pointer to a file in the static file storage, editable by users with the appropriate permissions on the front-end.
func NewDocument ¶
NewDocument creates a new Document.
type HealthCheckComponent ¶
type HealthCheckComponent string
HealthCheckComponent represents a component of the application.
const ( HealthCheckComponentCacheDB HealthCheckComponent = "cache_database" // cache database HealthCheckComponentGraphDB HealthCheckComponent = "graph_database" // graph database HealthCheckComponentRelationalDB HealthCheckComponent = "relational_database" // relational database HealthCheckComponentLicense HealthCheckComponent = "license" // license HealthCheckComponentMessageQueue HealthCheckComponent = "message_queue" // message_queue )
type HealthStatus ¶
type HealthStatus uint8
HealthStatus is the status of a component.
const ( HealthStatusUnknown HealthStatus = iota // component is in an unknown state HealthStatusHealthy // component is healthy HealthStatusUnhealthy // component is unhealthy )
func (HealthStatus) MarshalText ¶
func (s HealthStatus) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (HealthStatus) String ¶
func (s HealthStatus) String() string
String returns the string representation of the health status.
func (*HealthStatus) UnmarshalText ¶
func (s *HealthStatus) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type ID ¶
type ID struct { Inner xid.ID Type ResourceType }
ID represents a unique identifier for a resource, combining a resource Type and a unique identifier.
func MustNewID ¶
func MustNewID(typ ResourceType) ID
MustNewID creates a new ID. It panics if the type is invalid.
func MustNewNilID ¶
func MustNewNilID(typ ResourceType) ID
MustNewNilID creates a new ID with a nil xid.ID. It panics if the type is invalid.
func NewIDFromString ¶
NewIDFromString creates a new ID from a string. The string must be a valid xid string.
func NewNilID ¶
func NewNilID(typ ResourceType) (ID, error)
NewNilID creates a new ID with a nil xid.ID.
type Issue ¶
type Issue struct { ID ID `json:"id" validate:"required"` NumericID uint `json:"numeric_id" validate:"required"` Parent *ID `json:"parent" validate:"omitempty"` Kind IssueKind `json:"kind" validate:"required,min=1,max=4"` Title string `json:"title" validate:"required,min=3,max=120"` Description string `json:"description" validate:"omitempty,min=10"` Status IssueStatus `json:"status" validate:"required,min=1,max=6"` Priority IssuePriority `json:"priority" validate:"required,min=1,max=5"` Resolution IssueResolution `json:"resolution" validate:"required,min=1,max=7"` ReportedBy ID `json:"reported_by" validate:"required"` Assignees []ID `json:"assignees" validate:"omitempty,dive"` Labels []ID `json:"labels" validate:"omitempty,dive"` Comments []ID `json:"comments" validate:"omitempty,dive"` Attachments []ID `json:"attachments" validate:"omitempty,dive"` Watchers []ID `json:"watchers" validate:"omitempty,dive"` Relations []ID `json:"relations" validate:"omitempty,dive"` Links []string `json:"links" validate:"omitempty,dive,url"` DueDate *time.Time `json:"due_date" validate:"omitempty"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Issue represents an issue in the system that can be assigned to a user and belong to a project or another Issue.
type IssueKind ¶
type IssueKind uint8
IssueKind represents a kind of issue.
func (IssueKind) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*IssueKind) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type IssuePriority ¶
type IssuePriority uint8
IssuePriority represents the priority of an issue.
const ( IssuePriorityLow IssuePriority = iota + 1 // low IssuePriorityMedium // medium IssuePriorityHigh // high IssuePriorityCritical // critical )
func (IssuePriority) MarshalText ¶
func (p IssuePriority) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (IssuePriority) String ¶
func (p IssuePriority) String() string
String returns the string representation of IssuePriority.
func (*IssuePriority) UnmarshalText ¶
func (p *IssuePriority) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type IssueRelation ¶
type IssueRelation struct { ID ID `json:"id" validate:"required"` Source ID `json:"source" validate:"required"` Target ID `json:"target" validate:"required"` Kind IssueRelationKind `json:"kind" validate:"required,min=1,max=7"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
IssueRelation represents a relation between two issues.
func NewIssueRelation ¶
func NewIssueRelation(source, target ID, kind IssueRelationKind) (*IssueRelation, error)
NewIssueRelation creates a relation between issues.
func (*IssueRelation) Validate ¶
func (i *IssueRelation) Validate() error
Validate validates the issue relation details.
type IssueRelationKind ¶
type IssueRelationKind uint8
IssueRelationKind represents the kind of relation between two issues.
const ( IssueRelationKindBlockedBy IssueRelationKind = iota + 1 // blocked by IssueRelationKindBlocks // blocks IssueRelationKindDependsOn // depends on IssueRelationKindDuplicatedBy // duplicated by IssueRelationKindDuplicates // duplicates IssueRelationKindRelatedTo // related to IssueRelationKindSubtaskOf // subtask of )
func (IssueRelationKind) MarshalText ¶
func (r IssueRelationKind) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (IssueRelationKind) String ¶
func (r IssueRelationKind) String() string
String returns the string representation of IssueKind.
func (*IssueRelationKind) UnmarshalText ¶
func (r *IssueRelationKind) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type IssueResolution ¶
type IssueResolution uint8
IssueResolution represents the resolution of an issue.
const ( IssueResolutionNone IssueResolution = iota + 1 // none IssueResolutionFixed // fixed IssueResolutionDuplicate // duplicate IssueResolutionWontFix // won't fix IssueResolutionInvalid // invalid IssueResolutionIncomplete // incomplete IssueResolutionCannotReproduce // cannot reproduce )
func (IssueResolution) MarshalText ¶
func (r IssueResolution) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (IssueResolution) String ¶
func (r IssueResolution) String() string
String returns the string representation of IssueResolution.
func (*IssueResolution) UnmarshalText ¶
func (r *IssueResolution) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type IssueStatus ¶
type IssueStatus uint8
IssueStatus represents the status of an issue.
const ( IssueStatusOpen IssueStatus = iota + 1 // open IssueStatusInProgress // in progress IssueStatusBlocked // blocked IssueStatusReview // review IssueStatusDone // done IssueStatusClosed // closed )
func (IssueStatus) MarshalText ¶
func (s IssueStatus) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (IssueStatus) String ¶
func (s IssueStatus) String() string
String returns the string representation of IssueStatus.
func (*IssueStatus) UnmarshalText ¶
func (s *IssueStatus) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Label ¶
type Label struct { ID ID `json:"id" validate:"required"` Name string `json:"name" validate:"required,min=3,max=120"` Description string `json:"description" validate:"omitempty,min=5,max=500"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Label is an entity that can be attached to a resource to provide additional information about it. For example, a Type can be used to indicate the environment a resource belongs to.
type Language ¶
type Language uint8
Language represents a Language ISO code.
const ( LanguageAA Language = iota + 1 // ISO Language code of Afar LanguageAB // ISO Language code of Abkhazian LanguageAE // ISO Language code of Avestan LanguageAF // ISO Language code of Afrikaans LanguageAK // ISO Language code of Akan LanguageAM // ISO Language code of Amharic LanguageAN // ISO Language code of Aragonese LanguageAR // ISO Language code of Arabic LanguageAS // ISO Language code of Assamese LanguageAV // ISO Language code of Avaric LanguageAY // ISO Language code of Aymara LanguageAZ // ISO Language code of Azerbaijani LanguageBA // ISO Language code of Bashkir LanguageBE // ISO Language code of Belarusian LanguageBG // ISO Language code of Bulgarian LanguageBH // ISO Language code of Bihari Languages LanguageBI // ISO Language code of Bislama LanguageBM // ISO Language code of Bambara LanguageBN // ISO Language code of Bengali LanguageBO // ISO Language code of Tibetan LanguageBR // ISO Language code of Breton LanguageBS // ISO Language code of Bosnian LanguageCA // ISO Language code of Catalan LanguageCE // ISO Language code of Chechen LanguageCH // ISO Language code of Chamorro LanguageCO // ISO Language code of Corsican LanguageCR // ISO Language code of Cree LanguageCS // ISO Language code of Czech LanguageCU // ISO Language code of Church Slavic LanguageCV // ISO Language code of Chuvash LanguageCY // ISO Language code of Welsh LanguageDA // ISO Language code of Danish LanguageDE // ISO Language code of German LanguageDV // ISO Language code of Divehi LanguageDZ // ISO Language code of Dzongkha LanguageEE // ISO Language code of Ewe LanguageEL // ISO Language code of Greek LanguageEN // ISO Language code of English LanguageEO // ISO Language code of Esperanto LanguageES // ISO Language code of Spanish LanguageET // ISO Language code of Estonian LanguageEU // ISO Language code of Basque LanguageFA // ISO Language code of Persian LanguageFF // ISO Language code of Fulah LanguageFI // ISO Language code of Finnish LanguageFJ // ISO Language code of Fijian LanguageFO // ISO Language code of Faroese LanguageFR // ISO Language code of French LanguageFY // ISO Language code of Western Frisian LanguageGA // ISO Language code of Irish LanguageGD // ISO Language code of Gaelic LanguageGL // ISO Language code of Galician LanguageGN // ISO Language code of Guarani LanguageGU // ISO Language code of Gujarati LanguageGV // ISO Language code of Manx LanguageHA // ISO Language code of Hausa LanguageHE // ISO Language code of Hebrew LanguageHI // ISO Language code of Hindi LanguageHO // ISO Language code of Hiri Motu LanguageHR // ISO Language code of Croatian LanguageHT // ISO Language code of Haitian LanguageHU // ISO Language code of Hungarian LanguageHY // ISO Language code of Armenian LanguageHZ // ISO Language code of Herero LanguageIA // ISO Language code of Interlingua LanguageID // ISO Language code of Indonesian LanguageIE // ISO Language code of Interlingue LanguageIG // ISO Language code of Igbo LanguageII // ISO Language code of Sichuan Yi LanguageIK // ISO Language code of Inupiaq LanguageIO // ISO Language code of Ido LanguageIS // ISO Language code of Icelandic LanguageIT // ISO Language code of Italian LanguageIU // ISO Language code of Inuktitut LanguageJA // ISO Language code of Japanese LanguageJV // ISO Language code of Javanese LanguageKA // ISO Language code of Georgian LanguageKG // ISO Language code of Kongo LanguageKI // ISO Language code of Kikuyu LanguageKJ // ISO Language code of Kuanyama LanguageKK // ISO Language code of Kazakh LanguageKL // ISO Language code of Kalaallisut LanguageKM // ISO Language code of Central Khmer LanguageKN // ISO Language code of Kannada LanguageKO // ISO Language code of Korean LanguageKR // ISO Language code of Kanuri LanguageKS // ISO Language code of Kashmiri LanguageKU // ISO Language code of Kurdish LanguageKV // ISO Language code of Komi LanguageKW // ISO Language code of Cornish LanguageKY // ISO Language code of Kirghiz LanguageLA // ISO Language code of Latin LanguageLB // ISO Language code of Luxembourgish LanguageLG // ISO Language code of Ganda LanguageLI // ISO Language code of Limburgan LanguageLN // ISO Language code of Lingala LanguageLO // ISO Language code of Lao LanguageLT // ISO Language code of Lithuanian LanguageLU // ISO Language code of Luba-Katanga LanguageLV // ISO Language code of Latvian LanguageMG // ISO Language code of Malagasy LanguageMH // ISO Language code of Marshallese LanguageMI // ISO Language code of Maori LanguageMK // ISO Language code of Macedonian LanguageML // ISO Language code of Malayalam LanguageMN // ISO Language code of Mongolian LanguageMR // ISO Language code of Marathi LanguageMS // ISO Language code of Malay LanguageMT // ISO Language code of Maltese LanguageMY // ISO Language code of Burmese LanguageNA // ISO Language code of Nauru LanguageNB // ISO Language code of Norwegian Bokmål LanguageND // ISO Language code of North Ndebele LanguageNE // ISO Language code of Nepali LanguageNG // ISO Language code of Ndonga LanguageNL // ISO Language code of Dutch; Flemish LanguageNN // ISO Language code of Norwegian Nynorsk LanguageNO // ISO Language code of Norwegian LanguageNR // ISO Language code of South Ndebele LanguageNV // ISO Language code of Navajo LanguageNY // ISO Language code of Chichewa LanguageOC // ISO Language code of Occitan LanguageOJ // ISO Language code of Ojibwa LanguageOM // ISO Language code of Oromo LanguageOR // ISO Language code of Oriya LanguageOS // ISO Language code of Ossetian LanguagePA // ISO Language code of Panjabi LanguagePI // ISO Language code of Pali LanguagePL // ISO Language code of Polish LanguagePS // ISO Language code of Pushto LanguagePT // ISO Language code of Portuguese LanguageQU // ISO Language code of Quechua LanguageRM // ISO Language code of Romansh LanguageRN // ISO Language code of Rundi LanguageRO // ISO Language code of Romanian LanguageRU // ISO Language code of Russian LanguageRW // ISO Language code of Kinyarwanda LanguageSA // ISO Language code of Sanskrit LanguageSC // ISO Language code of Sardinian LanguageSD // ISO Language code of Sindhi LanguageSE // ISO Language code of Northern Sami LanguageSG // ISO Language code of Sango LanguageSI // ISO Language code of Sinhala; Sinhalese LanguageSK // ISO Language code of Slovak LanguageSL // ISO Language code of Slovenian LanguageSM // ISO Language code of Samoan LanguageSN // ISO Language code of Shona LanguageSO // ISO Language code of Somali LanguageSQ // ISO Language code of Albanian LanguageSR // ISO Language code of Serbian LanguageSS // ISO Language code of Swati LanguageST // ISO Language code of Sotho LanguageSU // ISO Language code of Sundanese LanguageSV // ISO Language code of Swedish LanguageSW // ISO Language code of Swahili LanguageTA // ISO Language code of Tamil LanguageTE // ISO Language code of Telugu LanguageTG // ISO Language code of Tajik LanguageTH // ISO Language code of Thai LanguageTI // ISO Language code of Tigrinya LanguageTK // ISO Language code of Turkmen LanguageTL // ISO Language code of Tagalog LanguageTN // ISO Language code of Tswana LanguageTO // ISO Language code of Tonga LanguageTR // ISO Language code of Turkish LanguageTS // ISO Language code of Tsonga LanguageTT // ISO Language code of Tatar LanguageTW // ISO Language code of Twi LanguageTY // ISO Language code of Tahitian LanguageUG // ISO Language code of Uighur LanguageUK // ISO Language code of Ukrainian LanguageUR // ISO Language code of Urdu LanguageUZ // ISO Language code of Uzbek LanguageVE // ISO Language code of Venda LanguageVI // ISO Language code of Vietnamese LanguageVO // ISO Language code of Volapük LanguageWA // ISO Language code of Walloon LanguageWO // ISO Language code of Wolof LanguageXH // ISO Language code of Xhosa LanguageYI // ISO Language code of Yiddish LanguageYO // ISO Language code of Yoruba LanguageZA // ISO Language code of Zhuang LanguageZH // ISO Language code of Chinese LanguageZU // ISO Language code of Zulu )
func (Language) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Language) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Namespace ¶
type Namespace struct { ID ID `json:"id" validate:"required"` Name string `json:"name" validate:"required,min=3,max=120"` Description string `json:"description" validate:"omitempty,min=5,max=500"` Projects []ID `json:"projects" validate:"omitempty,dive"` Documents []ID `json:"documents" validate:"omitempty,dive"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Namespace represents a namespace of an organization. A namespace is a logical grouping of Projects and Documents.
func NewNamespace ¶
NewNamespace creates a new Namespace.
type Notification ¶
type Notification struct { ID ID `json:"id" validate:"required"` Title string `json:"name" validate:"required,min=3,max=120"` Description string `json:"description" validate:"omitempty,min=5,max=500"` Recipient ID `json:"recipient" validate:"required"` Read bool `json:"read"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Notification represents an in-app notification that is usually sent by the application.
func NewNotification ¶
func NewNotification(title string, recipient ID) (*Notification, error)
NewNotification creates a new Notification.
func (*Notification) Validate ¶
func (n *Notification) Validate() error
type Organization ¶
type Organization struct { ID ID `json:"id" validate:"required"` Name string `json:"name" validate:"required,min=1,max=120"` Email string `json:"email" validate:"required,email"` Logo string `json:"logo" validate:"omitempty,url"` Website string `json:"website" validate:"omitempty,url"` Status OrganizationStatus `json:"status" validate:"required,min=1,max=2"` Namespaces []ID `json:"namespaces" validate:"omitempty,dive"` Teams []ID `json:"teams" validate:"omitempty,dive"` Members []ID `json:"members" validate:"omitempty,dive"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Organization represents an organization.
func NewOrganization ¶
func NewOrganization(name, email string) (*Organization, error)
NewOrganization creates a new Organization.
func (*Organization) Validate ¶
func (o *Organization) Validate() error
type OrganizationStatus ¶
type OrganizationStatus int
OrganizationStatus represents the status of the organization.
const ( OrganizationStatusActive OrganizationStatus = iota + 1 // active organization OrganizationStatusDeleted // deleted organization )
func (OrganizationStatus) MarshalText ¶
func (s OrganizationStatus) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (OrganizationStatus) String ¶
func (s OrganizationStatus) String() string
String returns the string representation of the organization status.
func (*OrganizationStatus) UnmarshalText ¶
func (s *OrganizationStatus) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Permission ¶
type Permission struct { ID ID `json:"id" validate:"required"` Kind PermissionKind `json:"kind" validate:"required,min=1,max=5"` Subject ID `json:"subject" validate:"required"` Target ID `json:"target" validate:"required"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Permission represents a permission attached to a relation. The permission defines the kind of access a subject has on a target.
func NewPermission ¶
func NewPermission(subject, target ID, kind PermissionKind) (*Permission, error)
NewPermission creates a new permission.
func (*Permission) Validate ¶
func (p *Permission) Validate() error
Validate validates the permission details.
type PermissionKind ¶
type PermissionKind uint8
PermissionKind represents a permission attached to a relation.
const ( PermissionKindAll PermissionKind = iota + 1 // permission to do everything on a resource PermissionKindCreate // permission to create a resource PermissionKindRead // permission to read a resource PermissionKindWrite // permission to write a resource PermissionKindDelete // permission to delete a resource )
func (PermissionKind) MarshalText ¶
func (p PermissionKind) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (PermissionKind) String ¶
func (p PermissionKind) String() string
String returns the string representation of the permission.
func (*PermissionKind) UnmarshalText ¶
func (p *PermissionKind) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Project ¶
type Project struct { ID ID `json:"id" validate:"required"` Key string `json:"key" validate:"required,alpha,min=3,max=6"` Name string `json:"name" validate:"required,min=3,max=120"` Description string `json:"description" validate:"omitempty,min=10,max=500"` Logo string `json:"logo" validate:"omitempty,url"` Status ProjectStatus `json:"status" validate:"required,min=1,max=2"` Teams []ID `json:"teams" validate:"omitempty,dive"` Documents []ID `json:"documents" validate:"omitempty,dive"` Issues []ID `json:"issues" validate:"omitempty,dive"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Project represents a project that is used to group tasks together.
func NewProject ¶
NewProject creates a new project.
type ProjectStatus ¶
type ProjectStatus uint8
ProjectStatus represents the status of a project.
const ( ProjectStatusActive ProjectStatus = iota + 1 // project is active ProjectStatusPending // project is pending )
func (ProjectStatus) MarshalText ¶
func (s ProjectStatus) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (ProjectStatus) String ¶
func (s ProjectStatus) String() string
String returns the string representation of the ProjectStatus.
func (*ProjectStatus) UnmarshalText ¶
func (s *ProjectStatus) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type ResourceType ¶
type ResourceType uint8
ResourceType is the type of resource that is being managed in the system. The resource type is used to help permission checks and to determine which resource types are available (eg. User, Issue, Label, etc.).
const ( ResourceTypeResourceType ResourceType = iota + 1 // resource type ResourceTypeAssignment // assignment resource type ResourceTypeAttachment // attachment resource type ResourceTypeComment // comment resource type ResourceTypeDocument // document resource type ResourceTypeIssue // issue resource type ResourceTypeIssueRelation // issue relation resource type ResourceTypeLabel // Type resource type ResourceTypeNamespace // namespace resource type ResourceTypeNotification // notification resource type ResourceTypeOrganization // organization resource type ResourceTypePermission // permission resource type ResourceTypeProject // project resource type ResourceTypeRole // role resource type ResourceTypeTodo // todo resource type ResourceTypeUser // user resource type )
func (ResourceType) MarshalText ¶
func (t ResourceType) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (ResourceType) String ¶
func (t ResourceType) String() string
String returns the string representation of the resource type.
func (*ResourceType) UnmarshalText ¶
func (t *ResourceType) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Role ¶
type Role struct { ID ID `json:"id" validate:"required"` Name string `json:"name" validate:"required,min=3,max=120"` Description string `json:"description" validate:"omitempty,min=5,max=500"` Members []ID `json:"members" validate:"omitempty,dive"` Permissions []ID `json:"permissions" validate:"omitempty,dive"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Role is a group of users. However, permissions are attached to roles separately to avoid infinitely nested permissions.
type SystemRole ¶
type SystemRole uint8
SystemRole is a special role that is created by the system.
const ( SystemRoleOwner SystemRole = iota + 1 // the owner them of the instance SystemRoleAdmin // the administrator team of the instance SystemRoleSupport // the support team of the instance )
func (SystemRole) MarshalText ¶
func (r SystemRole) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (SystemRole) String ¶
func (r SystemRole) String() string
String returns the string representation of the SystemRole.
func (*SystemRole) UnmarshalText ¶
func (r *SystemRole) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Todo ¶
type Todo struct { ID ID `json:"id" validate:"required"` Title string `json:"title" validate:"required,min=3,max=120"` Description string `json:"description" validate:"omitempty,min=10,max=500"` Priority TodoPriority `json:"priority" validate:"required,min=1,max=4"` Completed bool `json:"completed"` OwnedBy ID `json:"owned_by" validate:"required"` CreatedBy ID `json:"created_by" validate:"required"` DueDate *time.Time `json:"due_date" validate:"omitempty"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
Todo represents a todo in the system.
type TodoPriority ¶
type TodoPriority uint8
TodoPriority represents the priority of the Todo item.
const ( TodoPriorityNormal TodoPriority = iota + 1 // the todo is normal TodoPriorityImportant // the todo is important TodoPriorityUrgent // the todo is urgent TodoPriorityCritical // the todo is critical )
func (TodoPriority) MarshalText ¶
func (p TodoPriority) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (TodoPriority) String ¶
func (p TodoPriority) String() string
String returns the string representation of the TodoPriority.
func (*TodoPriority) UnmarshalText ¶
func (p *TodoPriority) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type User ¶
type User struct { ID ID `json:"id" validate:"required"` Username string `json:"username" validate:"required,lowercase,min=3,max=50,containsany=0123456789abcdefghijklmnopqrstuvwxyz-_"` Email string `json:"email" validate:"required,email"` Password string `json:"password" validate:"required,min=8,max=64"` Status UserStatus `json:"status" validate:"required,min=1,max=4"` FirstName string `json:"first_name" validate:"omitempty,max=50"` LastName string `json:"last_name" validate:"omitempty,max=50"` Picture string `json:"picture" validate:"omitempty,url"` Title string `json:"title" validate:"omitempty,min=3,max=50"` Bio string `json:"bio" validate:"omitempty,min=10,max=500"` Phone string `json:"phone" validate:"omitempty,min=7,max=16"` Address string `json:"address" validate:"omitempty,min=3,max=500"` Links []string `json:"links" validate:"omitempty,dive,url"` Languages []Language `json:"languages" validate:"omitempty,dive"` Documents []ID `json:"documents" validate:"omitempty,dive"` Permissions []ID `json:"permissions" validate:"omitempty,dive"` CreatedAt *time.Time `json:"created_at" validate:"omitempty"` UpdatedAt *time.Time `json:"updated_at" validate:"omitempty"` }
User represents a user in the system.
type UserStatus ¶
type UserStatus uint8
UserStatus represents the status of the User in the system.
const ( UserStatusActive UserStatus = iota + 1 // the user is active UserStatusPending // the user is invited but not yet active UserStatusInactive // the user is inactive UserStatusDeleted // the user is deleted )
func (UserStatus) MarshalText ¶
func (s UserStatus) MarshalText() (text []byte, err error)
MarshalText implements the encoding.TextMarshaler interface.
func (UserStatus) String ¶
func (s UserStatus) String() string
String returns the string representation of the UserStatus.
func (*UserStatus) UnmarshalText ¶
func (s *UserStatus) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.