domain

package
v1.64.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2018 License: AGPL-3.0 Imports: 20 Imported by: 113

Documentation

Overview

Package domain defines data structures for moving data between services.

Package domain ...

Index

Constants

View Source
const DocumizeContextKey key = "documize context key"

DocumizeContextKey prevents key name collisions.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountStorer

type AccountStorer interface {
	Add(ctx RequestContext, account account.Account) (err error)
	GetUserAccount(ctx RequestContext, userID string) (account account.Account, err error)
	GetUserAccounts(ctx RequestContext, userID string) (t []account.Account, err error)
	GetAccountsByOrg(ctx RequestContext) (t []account.Account, err error)
	DeleteAccount(ctx RequestContext, ID string) (rows int64, err error)
	UpdateAccount(ctx RequestContext, account account.Account) (err error)
	HasOrgAccount(ctx RequestContext, orgID, userID string) bool
	CountOrgAccounts(ctx RequestContext) int
}

AccountStorer defines required methods for account management

type ActivityStorer

type ActivityStorer interface {
	RecordUserActivity(ctx RequestContext, activity activity.UserActivity) (err error)
	GetDocumentActivity(ctx RequestContext, id string) (a []activity.DocumentActivity, err error)
	DeleteDocumentChangeActivity(ctx RequestContext, id string) (rows int64, err error)
}

ActivityStorer defines required methods for persisting document activity

type AttachmentStorer

type AttachmentStorer interface {
	Add(ctx RequestContext, a attachment.Attachment) (err error)
	GetAttachment(ctx RequestContext, orgID, attachmentID string) (a attachment.Attachment, err error)
	GetAttachments(ctx RequestContext, docID string) (a []attachment.Attachment, err error)
	GetAttachmentsWithData(ctx RequestContext, docID string) (a []attachment.Attachment, err error)
	Delete(ctx RequestContext, id string) (rows int64, err error)
}

AttachmentStorer defines required methods for persisting document attachments

type AuditStorer

type AuditStorer interface {
	// Record logs audit entry using own DB Transaction
	Record(ctx RequestContext, t audit.EventType)
}

AuditStorer defines required methods for audit trails

type BlockStorer

type BlockStorer interface {
	Add(ctx RequestContext, b block.Block) (err error)
	Get(ctx RequestContext, id string) (b block.Block, err error)
	GetBySpace(ctx RequestContext, spaceID string) (b []block.Block, err error)
	IncrementUsage(ctx RequestContext, id string) (err error)
	DecrementUsage(ctx RequestContext, id string) (err error)
	RemoveReference(ctx RequestContext, id string) (err error)
	Update(ctx RequestContext, b block.Block) (err error)
	Delete(ctx RequestContext, id string) (rows int64, err error)
}

BlockStorer defines required methods for persisting reusable content blocks

type CategoryStorer added in v1.54.0

type CategoryStorer interface {
	Add(ctx RequestContext, c category.Category) (err error)
	Update(ctx RequestContext, c category.Category) (err error)
	Get(ctx RequestContext, id string) (c category.Category, err error)
	GetBySpace(ctx RequestContext, spaceID string) (c []category.Category, err error)
	GetAllBySpace(ctx RequestContext, spaceID string) (c []category.Category, err error)
	GetSpaceCategorySummary(ctx RequestContext, spaceID string) (c []category.SummaryModel, err error)
	Delete(ctx RequestContext, id string) (rows int64, err error)
	AssociateDocument(ctx RequestContext, m category.Member) (err error)
	DisassociateDocument(ctx RequestContext, categoryID, documentID string) (rows int64, err error)
	RemoveCategoryMembership(ctx RequestContext, categoryID string) (rows int64, err error)
	DeleteBySpace(ctx RequestContext, spaceID string) (rows int64, err error)
	GetDocumentCategoryMembership(ctx RequestContext, documentID string) (c []category.Category, err error)
	GetSpaceCategoryMembership(ctx RequestContext, spaceID string) (c []category.Member, err error)
	RemoveDocumentCategories(ctx RequestContext, documentID string) (rows int64, err error)
	RemoveSpaceCategoryMemberships(ctx RequestContext, spaceID string) (rows int64, err error)
}

CategoryStorer defines required methods for category and category membership management

type DocumentStorer

type DocumentStorer interface {
	Add(ctx RequestContext, document doc.Document) (err error)
	Get(ctx RequestContext, id string) (document doc.Document, err error)
	GetBySpace(ctx RequestContext, spaceID string) (documents []doc.Document, err error)
	TemplatesBySpace(ctx RequestContext, spaceID string) (documents []doc.Document, err error)
	DocumentMeta(ctx RequestContext, id string) (meta doc.DocumentMeta, err error)
	PublicDocuments(ctx RequestContext, orgID string) (documents []doc.SitemapDocument, err error)
	Update(ctx RequestContext, document doc.Document) (err error)
	UpdateGroup(ctx RequestContext, document doc.Document) (err error)
	ChangeDocumentSpace(ctx RequestContext, document, space string) (err error)
	MoveDocumentSpace(ctx RequestContext, id, move string) (err error)
	Delete(ctx RequestContext, documentID string) (rows int64, err error)
	DeleteBySpace(ctx RequestContext, spaceID string) (rows int64, err error)
	GetVersions(ctx RequestContext, groupID string) (v []doc.Version, err error)
	MoveActivity(ctx RequestContext, documentID, oldSpaceID, newSpaceID string) (err error)
	Vote(ctx RequestContext, refID, orgID, documentID, userID string, vote int) (err error)
}

DocumentStorer defines required methods for document handling

type GroupStorer added in v1.58.0

type GroupStorer interface {
	Add(ctx RequestContext, g group.Group) (err error)
	Get(ctx RequestContext, refID string) (g group.Group, err error)
	GetAll(ctx RequestContext) (g []group.Group, err error)
	Update(ctx RequestContext, g group.Group) (err error)
	Delete(ctx RequestContext, refID string) (rows int64, err error)
	GetGroupMembers(ctx RequestContext, groupID string) (m []group.Member, err error)
	GetMembers(ctx RequestContext) (r []group.Record, err error)
	JoinGroup(ctx RequestContext, groupID, userID string) (err error)
	LeaveGroup(ctx RequestContext, groupID, userID string) (err error)
}

GroupStorer defines required methods for persisting user groups and memberships

type Indexer

type Indexer interface {
	IndexDocument(ctx RequestContext, d doc.Document, a []attachment.Attachment)
	DeleteDocument(ctx RequestContext, ID string)
	IndexContent(ctx RequestContext, p page.Page)
	DeleteContent(ctx RequestContext, pageID string)
}

Indexer defines required methods for managing search indexing process

type LinkStorer

type LinkStorer interface {
	Add(ctx RequestContext, l link.Link) (err error)
	SearchCandidates(ctx RequestContext, keywords string) (docs []link.Candidate, pages []link.Candidate, attachments []link.Candidate, err error)
	GetDocumentOutboundLinks(ctx RequestContext, documentID string) (links []link.Link, err error)
	GetPageLinks(ctx RequestContext, documentID, pageID string) (links []link.Link, err error)
	MarkOrphanDocumentLink(ctx RequestContext, documentID string) (err error)
	MarkOrphanPageLink(ctx RequestContext, pageID string) (err error)
	MarkOrphanAttachmentLink(ctx RequestContext, attachmentID string) (err error)
	DeleteSourcePageLinks(ctx RequestContext, pageID string) (rows int64, err error)
	DeleteSourceDocumentLinks(ctx RequestContext, documentID string) (rows int64, err error)
	DeleteLink(ctx RequestContext, id string) (rows int64, err error)
}

LinkStorer defines required methods for persisting content links

type MetaStorer added in v1.60.0

type MetaStorer interface {
	GetDocumentsID(ctx RequestContext) (documents []string, err error)
	GetDocumentPages(ctx RequestContext, documentID string) (p []page.Page, err error)
	SearchIndexCount(ctx RequestContext) (c int, err error)
}

MetaStorer provide specialist methods for global administrators.

type OrganizationStorer

type OrganizationStorer interface {
	AddOrganization(ctx RequestContext, org org.Organization) error
	GetOrganization(ctx RequestContext, id string) (org org.Organization, err error)
	GetOrganizationByDomain(subdomain string) (org org.Organization, err error)
	UpdateOrganization(ctx RequestContext, org org.Organization) (err error)
	DeleteOrganization(ctx RequestContext, orgID string) (rows int64, err error)
	RemoveOrganization(ctx RequestContext, orgID string) (err error)
	UpdateAuthConfig(ctx RequestContext, org org.Organization) (err error)
	CheckDomain(ctx RequestContext, domain string) string
}

OrganizationStorer defines required methods for organization management

type PageStorer

type PageStorer interface {
	Add(ctx RequestContext, model page.NewPage) (err error)
	Get(ctx RequestContext, pageID string) (p page.Page, err error)
	GetPages(ctx RequestContext, documentID string) (p []page.Page, err error)
	GetUnpublishedPages(ctx RequestContext, documentID string) (p []page.Page, err error)
	GetPagesWithoutContent(ctx RequestContext, documentID string) (pages []page.Page, err error)
	Update(ctx RequestContext, page page.Page, refID, userID string, skipRevision bool) (err error)
	Delete(ctx RequestContext, documentID, pageID string) (rows int64, err error)
	GetPageMeta(ctx RequestContext, pageID string) (meta page.Meta, err error)
	GetDocumentPageMeta(ctx RequestContext, documentID string, externalSourceOnly bool) (meta []page.Meta, err error)
	UpdateMeta(ctx RequestContext, meta page.Meta, updateUserID bool) (err error)
	UpdateSequence(ctx RequestContext, documentID, pageID string, sequence float64) (err error)
	UpdateLevel(ctx RequestContext, documentID, pageID string, level int) (err error)
	UpdateLevelSequence(ctx RequestContext, documentID, pageID string, level int, sequence float64) (err error)
	GetNextPageSequence(ctx RequestContext, documentID string) (maxSeq float64, err error)
	GetPageRevision(ctx RequestContext, revisionID string) (revision page.Revision, err error)
	GetPageRevisions(ctx RequestContext, pageID string) (revisions []page.Revision, err error)
	GetDocumentRevisions(ctx RequestContext, documentID string) (revisions []page.Revision, err error)
	DeletePageRevisions(ctx RequestContext, pageID string) (rows int64, err error)
}

PageStorer defines required methods for persisting document pages

type PermissionStorer added in v1.54.0

type PermissionStorer interface {
	AddPermission(ctx RequestContext, r permission.Permission) (err error)
	AddPermissions(ctx RequestContext, r permission.Permission, actions ...permission.Action) (err error)
	GetUserSpacePermissions(ctx RequestContext, spaceID string) (r []permission.Permission, err error)
	GetSpacePermissions(ctx RequestContext, spaceID string) (r []permission.Permission, err error)
	GetCategoryPermissions(ctx RequestContext, catID string) (r []permission.Permission, err error)
	GetCategoryUsers(ctx RequestContext, catID string) (u []user.User, err error)
	GetUserCategoryPermissions(ctx RequestContext, userID string) (r []permission.Permission, err error)
	GetUserDocumentPermissions(ctx RequestContext, documentID string) (r []permission.Permission, err error)
	GetDocumentPermissions(ctx RequestContext, documentID string) (r []permission.Permission, err error)
	DeleteDocumentPermissions(ctx RequestContext, documentID string) (rows int64, err error)
	DeleteSpacePermissions(ctx RequestContext, spaceID string) (rows int64, err error)
	DeleteUserSpacePermissions(ctx RequestContext, spaceID, userID string) (rows int64, err error)
	DeleteUserPermissions(ctx RequestContext, userID string) (rows int64, err error)
	DeleteCategoryPermissions(ctx RequestContext, categoryID string) (rows int64, err error)
	DeleteSpaceCategoryPermissions(ctx RequestContext, spaceID string) (rows int64, err error)
	DeleteGroupPermissions(ctx RequestContext, groupID string) (rows int64, err error)
}

PermissionStorer defines required methods for space/document permission management

type PinStorer

type PinStorer interface {
	Add(ctx RequestContext, pin pin.Pin) (err error)
	GetPin(ctx RequestContext, id string) (pin pin.Pin, err error)
	GetUserPins(ctx RequestContext, userID string) (pins []pin.Pin, err error)
	UpdatePin(ctx RequestContext, pin pin.Pin) (err error)
	UpdatePinSequence(ctx RequestContext, pinID string, sequence int) (err error)
	DeletePin(ctx RequestContext, id string) (rows int64, err error)
	DeletePinnedSpace(ctx RequestContext, spaceID string) (rows int64, err error)
	DeletePinnedDocument(ctx RequestContext, documentID string) (rows int64, err error)
}

PinStorer defines required methods for pin management

type RequestContext

type RequestContext struct {
	AllowAnonymousAccess bool
	Authenticated        bool
	Administrator        bool
	Guest                bool
	Editor               bool
	Global               bool
	Analytics            bool
	UserID               string
	OrgID                string
	OrgName              string
	SSL                  bool
	AppURL               string // e.g. https://{url}.documize.com
	Subdomain            string
	ClientIP             string
	Expires              time.Time
	Fullname             string
	Transaction          *sqlx.Tx
	AppVersion           string
}

RequestContext provides per request scoped values required by HTTP handlers.

func GetRequestContext

func GetRequestContext(r *http.Request) (ctx RequestContext)

GetRequestContext returns RequestContext from context.Context

func (*RequestContext) GetAppURL

func (c *RequestContext) GetAppURL(endpoint string) string

GetAppURL returns full HTTP url for the app

type SearchStorer

type SearchStorer interface {
	IndexDocument(ctx RequestContext, doc doc.Document, a []attachment.Attachment) (err error)
	DeleteDocument(ctx RequestContext, ID string) (err error)
	IndexContent(ctx RequestContext, p page.Page) (err error)
	DeleteContent(ctx RequestContext, pageID string) (err error)
	Documents(ctx RequestContext, q search.QueryOptions) (results []search.QueryResult, err error)
}

SearchStorer defines required methods for persisting search queries

type SettingStorer

type SettingStorer interface {
	Get(area, path string) (val string, err error)
	Set(area, value string) error
	GetUser(orgID, userID, area, path string) (val string, err error)
	SetUser(orgID, userID, area, json string) error
}

SettingStorer defines required methods for persisting global and user level settings

type SpaceStorer

type SpaceStorer interface {
	Add(ctx RequestContext, sp space.Space) (err error)
	Get(ctx RequestContext, id string) (sp space.Space, err error)
	PublicSpaces(ctx RequestContext, orgID string) (sp []space.Space, err error)
	GetViewable(ctx RequestContext) (sp []space.Space, err error)
	GetAll(ctx RequestContext) (sp []space.Space, err error)
	Update(ctx RequestContext, sp space.Space) (err error)
	Delete(ctx RequestContext, id string) (rows int64, err error)
}

SpaceStorer defines required methods for space management

type Store

type Store struct {
	Account      AccountStorer
	Activity     ActivityStorer
	Attachment   AttachmentStorer
	Audit        AuditStorer
	Block        BlockStorer
	Category     CategoryStorer
	Document     DocumentStorer
	Group        GroupStorer
	Link         LinkStorer
	Meta         MetaStorer
	Organization OrganizationStorer
	Page         PageStorer
	Pin          PinStorer
	Permission   PermissionStorer
	Search       SearchStorer
	Setting      SettingStorer
	Space        SpaceStorer
	User         UserStorer
}

Store provides access to data store (database)

type UserStorer

type UserStorer interface {
	Add(ctx RequestContext, u user.User) (err error)
	Get(ctx RequestContext, id string) (u user.User, err error)
	GetByDomain(ctx RequestContext, domain, email string) (u user.User, err error)
	GetByEmail(ctx RequestContext, email string) (u user.User, err error)
	GetByToken(ctx RequestContext, token string) (u user.User, err error)
	GetBySerial(ctx RequestContext, serial string) (u user.User, err error)
	GetActiveUsersForOrganization(ctx RequestContext) (u []user.User, err error)
	GetUsersForOrganization(ctx RequestContext, filter string) (u []user.User, err error)
	GetSpaceUsers(ctx RequestContext, spaceID string) (u []user.User, err error)
	GetUsersForSpaces(ctx RequestContext, spaces []string) (u []user.User, err error)
	UpdateUser(ctx RequestContext, u user.User) (err error)
	UpdateUserPassword(ctx RequestContext, userID, salt, password string) (err error)
	DeactiveUser(ctx RequestContext, userID string) (err error)
	ForgotUserPassword(ctx RequestContext, email, token string) (err error)
	CountActiveUsers() (c int)
	MatchUsers(ctx RequestContext, text string, maxMatches int) (u []user.User, err error)
}

UserStorer defines required methods for user management

Directories

Path Synopsis
account
activity
audit
mysql
Package audit records user events.
Package audit records user events.
Package category handles API calls and persistence for categories.
Package category handles API calls and persistence for categories.
mysql
Package mysql handles data persistence for both category definition and and document/category association.
Package mysql handles data persistence for both category definition and and document/category association.
store
Package store provides the implementation for a file system based storage provider.
Package store provides the implementation for a file system based storage provider.
Package permission handles API calls and persistence for spaces.
Package permission handles API calls and persistence for spaces.
mysql
Package mysql handles data persistence for space and document permissions.
Package mysql handles data persistence for space and document permissions.
pin
Package setting manages both global and user level settings Package setting manages both global and user level settings Package setting manages both global and user level settings
Package setting manages both global and user level settings Package setting manages both global and user level settings Package setting manages both global and user level settings
Package smtp provides access to SMTP server for sending email.
Package smtp provides access to SMTP server for sending email.
Package space handles API calls and persistence for spaces.
Package space handles API calls and persistence for spaces.
mysql
Package mysql handles data persistence for spaces.
Package mysql handles data persistence for spaces.
store

Jump to

Keyboard shortcuts

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