entity

package
v1.48.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2017 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package entity provides types that mirror database tables.

Package entity provides types that mirror database tables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	BaseEntity
	Admin   bool   `json:"admin"`
	Editor  bool   `json:"editor"`
	UserID  string `json:"userId"`
	OrgID   string `json:"orgId"`
	Company string `json:"company"`
	Title   string `json:"title"`
	Message string `json:"message"`
	Domain  string `json:"domain"`
	Active  bool   `json:"active"`
}

Account links a User to an Organization.

type ActivitySourceType added in v0.42.0

type ActivitySourceType int

ActivitySourceType details where the activity occured.

const (
	// ActivitySourceTypeSpace indicates activity against a space.
	ActivitySourceTypeSpace ActivitySourceType = 1

	// ActivitySourceTypeDocument indicates activity against a document.
	ActivitySourceTypeDocument ActivitySourceType = 2
)

type ActivityType added in v0.42.0

type ActivityType int

ActivityType determines type of user activity

const (
	// ActivityTypeCreated records user document creation
	ActivityTypeCreated ActivityType = 1

	// ActivityTypeRead states user has read document
	ActivityTypeRead ActivityType = 2

	// ActivityTypeEdited states user has editing document
	ActivityTypeEdited ActivityType = 3

	// ActivityTypeDeleted records user deleting space/document
	ActivityTypeDeleted ActivityType = 4

	// ActivityTypeArchived records user archiving space/document
	ActivityTypeArchived ActivityType = 5

	// ActivityTypeApproved records user approval of document
	ActivityTypeApproved ActivityType = 6

	// ActivityTypeReverted records user content roll-back to previous version
	ActivityTypeReverted ActivityType = 7

	// ActivityTypePublishedTemplate records user creating new document template
	ActivityTypePublishedTemplate ActivityType = 8

	// ActivityTypePublishedBlock records user creating reusable content block
	ActivityTypePublishedBlock ActivityType = 9

	// ActivityTypeFeedback records user providing document feedback
	ActivityTypeFeedback ActivityType = 10
)

type AppEvent added in v1.48.2

type AppEvent struct {
	ID      uint64    `json:"-"`
	OrgID   string    `json:"orgId"`
	UserID  string    `json:"userId"`
	Type    string    `json:"eventType"`
	IP      string    `json:"ip"`
	Created time.Time `json:"created"`
}

AppEvent represents an event initiated by a user.

type Attachment

type Attachment struct {
	BaseEntity
	OrgID      string `json:"orgId"`
	DocumentID string `json:"documentId"`
	Job        string `json:"job"`
	FileID     string `json:"fileId"`
	Filename   string `json:"filename"`
	Data       []byte `json:"-"`
	Extension  string `json:"extension"`
}

Attachment represents an attachment to a document.

type BaseEntity

type BaseEntity struct {
	ID      uint64    `json:"-"`
	RefID   string    `json:"id"`
	Created time.Time `json:"created"`
	Revised time.Time `json:"revised"`
}

BaseEntity contains the database fields used in every table.

type BaseEntityObfuscated

type BaseEntityObfuscated struct {
	ID      uint64    `json:"-"`
	RefID   string    `json:"-"`
	Created time.Time `json:"-"`
	Revised time.Time `json:"-"`
}

BaseEntityObfuscated is a mirror of BaseEntity, but with the fields invisible to JSON.

type Block added in v0.40.0

type Block struct {
	BaseEntity
	OrgID          string `json:"orgId"`
	LabelID        string `json:"folderId"`
	UserID         string `json:"userId"`
	ContentType    string `json:"contentType"`
	PageType       string `json:"pageType"`
	Title          string `json:"title"`
	Body           string `json:"body"`
	Excerpt        string `json:"excerpt"`
	RawBody        string `json:"rawBody"`        // a blob of data
	Config         string `json:"config"`         // JSON based custom config for this type
	ExternalSource bool   `json:"externalSource"` // true indicates data sourced externally
	Used           uint64 `json:"used"`
	Firstname      string `json:"firstname"`
	Lastname       string `json:"lastname"`
}

Block represents a section that has been published as a reusable content block.

type Document

type Document struct {
	BaseEntity
	OrgID    string `json:"orgId"`
	LabelID  string `json:"folderId"`
	UserID   string `json:"userId"`
	Job      string `json:"job"`
	Location string `json:"location"`
	Title    string `json:"name"`
	Excerpt  string `json:"excerpt"`
	Slug     string `json:"-"`
	Tags     string `json:"tags"`
	Template bool   `json:"template"`
	Layout   string `json:"layout"`
}

Document represents a document.

func (*Document) SetDefaults

func (d *Document) SetDefaults()

SetDefaults ensures on blanks and cleans.

type DocumentMeta

type DocumentMeta struct {
	Viewers []DocumentMetaViewer `json:"viewers"`
	Editors []DocumentMetaEditor `json:"editors"`
}

DocumentMeta details who viewed the document.

type DocumentMetaEditor

type DocumentMetaEditor struct {
	PageID    string    `json:"pageId"`
	UserID    string    `json:"userId"`
	Action    string    `json:"action"`
	Created   time.Time `json:"created"`
	Firstname string    `json:"firstname"`
	Lastname  string    `json:"lastname"`
}

DocumentMetaEditor contains the "edit" metatdata content.

type DocumentMetaViewer

type DocumentMetaViewer struct {
	UserID    string    `json:"userId"`
	Created   time.Time `json:"created"`
	Firstname string    `json:"firstname"`
	Lastname  string    `json:"lastname"`
}

DocumentMetaViewer contains the "view" metatdata content.

type DocumentSearch

type DocumentSearch struct {
	ID              string `json:"id"`
	DocumentID      string `json:"documentId"`
	DocumentTitle   string `json:"documentTitle"`
	DocumentSlug    string `json:"documentSlug"`
	DocumentExcerpt string `json:"documentExcerpt"`
	Tags            string `json:"documentTags"`
	PageTitle       string `json:"pageTitle"`
	LabelID         string `json:"folderId"`
	LabelName       string `json:"folderName"`
	FolderSlug      string `json:"folderSlug"`
}

DocumentSearch represents 'presentable' search results.

type EventType added in v1.48.2

type EventType string

EventType defines valid event entry types

const (
	EventTypeDocumentAdd        EventType = "added-document"
	EventTypeDocumentUpload     EventType = "uploaded-document"
	EventTypeDocumentView       EventType = "viewed-document"
	EventTypeDocumentUpdate     EventType = "updated-document"
	EventTypeDocumentDelete     EventType = "removed-document"
	EventTypeDocumentRevisions  EventType = "viewed-document-revisions"
	EventTypeSpaceAdd           EventType = "added-space"
	EventTypeSpaceUpdate        EventType = "updated-space"
	EventTypeSpaceDelete        EventType = "removed-space"
	EventTypeSpacePermission    EventType = "changed-space-permissions"
	EventTypeSpaceJoin          EventType = "joined-space"
	EventTypeSpaceInvite        EventType = "invited-space"
	EventTypeSectionAdd         EventType = "added-document-section"
	EventTypeSectionUpdate      EventType = "updated-document-section"
	EventTypeSectionDelete      EventType = "removed-document-section"
	EventTypeSectionRollback    EventType = "rolled-back-document-section"
	EventTypeSectionResequence  EventType = "resequenced-document-section"
	EventTypeSectionCopy        EventType = "copied-document-section"
	EventTypeAttachmentAdd      EventType = "added-attachment"
	EventTypeAttachmentDownload EventType = "downloaded-attachment"
	EventTypeAttachmentDelete   EventType = "removed-attachment"
	EventTypePinAdd             EventType = "added-pin"
	EventTypePinDelete          EventType = "removed-pin"
	EventTypePinResequence      EventType = "resequenced-pin"
	EventTypeBlockAdd           EventType = "added-reusable-block"
	EventTypeBlockUpdate        EventType = "updated-reusable-block"
	EventTypeBlockDelete        EventType = "removed-reusable-block"
	EventTypeTemplateAdd        EventType = "added-document-template"
	EventTypeTemplateUse        EventType = "used-document-template"
	EventTypeUserAdd            EventType = "added-user"
	EventTypeUserUpdate         EventType = "updated-user"
	EventTypeUserDelete         EventType = "removed-user"
	EventTypeUserPasswordReset  EventType = "reset-user-password"
	EventTypeAccountAdd         EventType = "added-account"
	EventTypeSystemLicense      EventType = "changed-system-license"
	EventTypeSystemAuth         EventType = "changed-system-auth"
	EventTypeSystemSMTP         EventType = "changed-system-smtp"
	EventTypeSessionStart       EventType = "started-session"
	EventTypeSearch             EventType = "searched"
)

type FolderType

type FolderType int

FolderType determines folder visibility.

const (
	// FolderTypePublic can be seen by anyone
	FolderTypePublic FolderType = 1

	// FolderTypePrivate can only be seen by the person who owns it
	FolderTypePrivate FolderType = 2

	// FolderTypeRestricted can be seen by selected users
	FolderTypeRestricted FolderType = 3
)

type FolderVisibility

type FolderVisibility struct {
	Name      string `json:"name"`
	LabelID   string `json:"folderId"`
	Type      int    `json:"folderType"`
	UserID    string `json:"userId"`
	Firstname string `json:"firstname"`
	Lastname  string `json:"lastname"`
	Email     string `json:"email"`
}

FolderVisibility details who can see a particular folder

type Label

type Label struct {
	BaseEntity
	Name   string     `json:"name"`
	OrgID  string     `json:"orgId"`
	UserID string     `json:"userId"`
	Type   FolderType `json:"folderType"`
}

Label defines a container for documents.

func (*Label) IsPrivate

func (l *Label) IsPrivate() bool

IsPrivate means the folder can only be seen by the person who owns it.

func (*Label) IsPublic

func (l *Label) IsPublic() bool

IsPublic means the folder can be seen by anyone.

func (*Label) IsRestricted

func (l *Label) IsRestricted() bool

IsRestricted means the folder can be seen by selected users.

type LabelRole

type LabelRole struct {
	BaseEntityObfuscated
	OrgID   string `json:"-"`
	LabelID string `json:"folderId"`
	UserID  string `json:"userId"`
	CanView bool   `json:"canView"`
	CanEdit bool   `json:"canEdit"`
}

LabelRole determines user permissions for a folder.

type Link struct {
	BaseEntity
	OrgID            string `json:"orgId"`
	FolderID         string `json:"folderId"`
	UserID           string `json:"userId"`
	LinkType         string `json:"linkType"`
	SourceDocumentID string `json:"sourceDocumentId"`
	SourcePageID     string `json:"sourcePageId"`
	TargetDocumentID string `json:"targetDocumentId"`
	TargetID         string `json:"targetId"`
	Orphan           bool   `json:"orphan"`
}

Link defines a reference between a section and another document/section/attachment.

type LinkCandidate added in v0.28.0

type LinkCandidate struct {
	RefID      string `json:"id"`
	LinkType   string `json:"linkType"`
	FolderID   string `json:"folderId"`
	DocumentID string `json:"documentId"`
	TargetID   string `json:"targetId"`
	Title      string `json:"title"`   // what we label the link
	Context    string `json:"context"` // additional context (e.g. excerpt, parent, file extension)
}

LinkCandidate defines a potential link to a document/section/attachment.

type NullTime added in v0.42.0

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

NullTime represents a time.Time that may be null. NullTime implements the sql.Scanner interface so it can be used as a scan destination, similar to sql.NullString.

func (*NullTime) Scan added in v0.42.0

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value added in v0.42.0

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Organization

type Organization struct {
	BaseEntity
	Company              string `json:"-"`
	Title                string `json:"title"`
	Message              string `json:"message"`
	URL                  string `json:"url"`
	Domain               string `json:"domain"`
	Email                string `json:"email"`
	AllowAnonymousAccess bool   `json:"allowAnonymousAccess"`
	AuthProvider         string `json:"authProvider"`
	AuthConfig           string `json:"authConfig"`
	ConversionEndpoint   string `json:"conversionEndpoint"`
	Serial               string `json:"-"`
	Active               bool   `json:"-"`
}

Organization defines a company that uses this app.

type Page

type Page struct {
	BaseEntity
	OrgID       string  `json:"orgId"`
	DocumentID  string  `json:"documentId"`
	UserID      string  `json:"userId"`
	ContentType string  `json:"contentType"`
	PageType    string  `json:"pageType"`
	BlockID     string  `json:"blockId"`
	Level       uint64  `json:"level"`
	Sequence    float64 `json:"sequence"`
	Title       string  `json:"title"`
	Body        string  `json:"body"`
	Revisions   uint64  `json:"revisions"`
}

Page represents a section within a document.

func (*Page) IsSectionType added in v0.31.0

func (p *Page) IsSectionType() bool

IsSectionType tells us that page is "words"

func (*Page) IsTabType added in v0.31.0

func (p *Page) IsTabType() bool

IsTabType tells us that page is "SaaS data embed"

func (*Page) SetDefaults

func (p *Page) SetDefaults()

SetDefaults ensures no blank values.

type PageMeta

type PageMeta struct {
	ID             uint64    `json:"id"`
	Created        time.Time `json:"created"`
	Revised        time.Time `json:"revised"`
	OrgID          string    `json:"orgId"`
	UserID         string    `json:"userId"`
	DocumentID     string    `json:"documentId"`
	PageID         string    `json:"pageId"`
	RawBody        string    `json:"rawBody"`        // a blob of data
	Config         string    `json:"config"`         // JSON based custom config for this type
	ExternalSource bool      `json:"externalSource"` // true indicates data sourced externally
}

PageMeta holds raw page data that is used to render the actual page data.

func (*PageMeta) SetDefaults

func (p *PageMeta) SetDefaults()

SetDefaults ensures no blank values.

type Pin added in v0.34.0

type Pin struct {
	BaseEntity
	OrgID      string `json:"orgId"`
	UserID     string `json:"userId"`
	FolderID   string `json:"folderId"`
	DocumentID string `json:"documentId"`
	Pin        string `json:"pin"`
	Sequence   int    `json:"sequence"`
}

Pin defines a saved link to a document or space

type Revision added in v0.35.0

type Revision struct {
	BaseEntity
	OrgID       string `json:"orgId"`
	DocumentID  string `json:"documentId"`
	PageID      string `json:"pageId"`
	OwnerID     string `json:"ownerId"`
	UserID      string `json:"userId"`
	ContentType string `json:"contentType"`
	PageType    string `json:"pageType"`
	Title       string `json:"title"`
	Body        string `json:"body"`
	RawBody     string `json:"rawBody"`
	Config      string `json:"config"`
	Email       string `json:"email"`
	Firstname   string `json:"firstname"`
	Lastname    string `json:"lastname"`
	Initials    string `json:"initials"`
	Revisions   int    `json:"revisions"`
}

Revision holds the previous version of a Page.

type Search struct {
	ID            string    `json:"id"`
	Created       time.Time `json:"created"`
	Revised       time.Time `json:"revised"`
	OrgID         string
	DocumentID    string
	Level         uint64
	Sequence      float64
	DocumentTitle string
	Slug          string
	PageTitle     string
	Body          string
}

Search holds raw search results.

type SiteMeta

type SiteMeta struct {
	OrgID                string `json:"orgId"`
	Title                string `json:"title"`
	Message              string `json:"message"`
	URL                  string `json:"url"`
	AllowAnonymousAccess bool   `json:"allowAnonymousAccess"`
	AuthProvider         string `json:"authProvider"`
	AuthConfig           string `json:"authConfig"`
	Version              string `json:"version"`
	Edition              string `json:"edition"`
	Valid                bool   `json:"valid"`
	ConversionEndpoint   string `json:"conversionEndpoint"`
}

SiteMeta holds information associated with an Organization.

type SitemapDocument

type SitemapDocument struct {
	DocumentID string
	Document   string
	FolderID   string
	Folder     string
	Revised    time.Time
}

SitemapDocument details a document that can be exposed via Sitemap.

type Template

type Template struct {
	ID          string       `json:"id"`
	Title       string       `json:"title"`
	Description string       `json:"description"`
	Author      string       `json:"author"`
	Type        TemplateType `json:"type"`
	Dated       time.Time    `json:"dated"`
}

Template is used to create a new document. Template can consist of content, attachments and have associated meta data indentifying author, version contact details and more.

func (*Template) IsPrivate

func (t *Template) IsPrivate() bool

IsPrivate means only the owner can see the template.

func (*Template) IsPublic

func (t *Template) IsPublic() bool

IsPublic means anyone can see the template.

func (*Template) IsRestricted

func (t *Template) IsRestricted() bool

IsRestricted means selected users can see the template.

type TemplateType

type TemplateType int

TemplateType determines who can see a template.

const (
	// TemplateTypePublic means anyone can see the template.
	TemplateTypePublic TemplateType = 1
	// TemplateTypePrivate means only the owner can see the template.
	TemplateTypePrivate TemplateType = 2
	// TemplateTypeRestricted means selected users can see the template.
	TemplateTypeRestricted TemplateType = 3
)

type User

type User struct {
	BaseEntity
	Firstname string    `json:"firstname"`
	Lastname  string    `json:"lastname"`
	Email     string    `json:"email"`
	Initials  string    `json:"initials"`
	Active    bool      `json:"active"`
	Editor    bool      `json:"editor"`
	Admin     bool      `json:"admin"`
	Global    bool      `json:"global"`
	Password  string    `json:"-"`
	Salt      string    `json:"-"`
	Reset     string    `json:"-"`
	Accounts  []Account `json:"accounts"`
}

User defines a login.

func (*User) Fullname

func (user *User) Fullname() string

Fullname returns Firstname + Lastname.

func (*User) GetAccount added in v1.48.2

func (user *User) GetAccount(orgID string) (a Account, found bool)

GetAccount returns matching org account using orgID

func (*User) ProtectSecrets

func (user *User) ProtectSecrets()

ProtectSecrets blanks sensitive data.

type UserActivity added in v0.42.0

type UserActivity struct {
	ID           uint64             `json:"-"`
	OrgID        string             `json:"orgId"`
	UserID       string             `json:"userId"`
	LabelID      string             `json:"folderId"`
	SourceID     string             `json:"sourceId"`
	SourceName   string             `json:"sourceName"` // e.g. Document or Space name
	SourceType   ActivitySourceType `json:"sourceType"`
	ActivityType ActivityType       `json:"activityType"`
	Created      time.Time          `json:"created"`
}

UserActivity represents an activity undertaken by a user.

Jump to

Keyboard shortcuts

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