community: github.com/documize/community/domain/document Index | Files

package document

import "github.com/documize/community/domain/document"

Index

Package Files

document.go endpoint.go export.go store.go

func BuildExport Uses

func BuildExport(ctx domain.RequestContext, s store.Store, spec exportSpec) (html string, err error)

BuildExport generates self-enclosed HTML for content specified.

func CopyDocument Uses

func CopyDocument(ctx domain.RequestContext, s store.Store, documentID string) (newDocumentID string, err error)

CopyDocument clones an existing document

func FilterCategoryProtected Uses

func FilterCategoryProtected(docs []doc.Document, cats []category.Category, members []category.Member, viewDrafts bool) (filtered []doc.Document)

FilterCategoryProtected removes documents that cannot be seen by user due to document cateogory viewing permissions.

func FilterLastVersion Uses

func FilterLastVersion(docs []doc.Document) (filtered []doc.Document)

FilterLastVersion returns the latest version of each document by removing all previous versions. If a document is not versioned, it is returned as-is.

type BulkDocumentData Uses

type BulkDocumentData struct {
    Document    doc.Document            `json:"document"`
    Permissions pm.Record               `json:"permissions"`
    Roles       pm.DocumentRecord       `json:"roles"`
    Spaces      []space.Space           `json:"folders"`
    Links       []link.Link             `json:"links"`
    Versions    []doc.Version           `json:"versions"`
    Attachments []attachment.Attachment `json:"attachments"`
}

BulkDocumentData represents all data associated for a single document. Used by FetchDocumentData() bulk data load call.

type Handler Uses

type Handler struct {
    Runtime *env.Runtime
    Store   *store.Store
    Indexer indexer.Indexer
}

Handler contains the runtime information such as logging and database.

func (*Handler) BySpace Uses

func (h *Handler) BySpace(w http.ResponseWriter, r *http.Request)

BySpace is an endpoint that returns the documents for given space.

func (*Handler) Delete Uses

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

Delete is an endpoint that deletes a document specified by documentID.

func (h *Handler) DocumentLinks(w http.ResponseWriter, r *http.Request)

DocumentLinks is an endpoint returning the links for a document.

func (*Handler) Duplicate Uses

func (h *Handler) Duplicate(w http.ResponseWriter, r *http.Request)

Duplicate makes a copy of a document. Name of new document is required.

func (*Handler) Export Uses

func (h *Handler) Export(w http.ResponseWriter, r *http.Request)

Export returns content as self-enclosed HTML file.

func (*Handler) FetchDocumentData Uses

func (h *Handler) FetchDocumentData(w http.ResponseWriter, r *http.Request)

FetchDocumentData returns all document data in single API call.

func (*Handler) Get Uses

func (h *Handler) Get(w http.ResponseWriter, r *http.Request)

Get is an endpoint that returns the document-level information for a given documentID.

func (*Handler) SearchDocuments Uses

func (h *Handler) SearchDocuments(w http.ResponseWriter, r *http.Request)

SearchDocuments endpoint takes a list of keywords and returns a list of document references matching those keywords.

func (*Handler) Update Uses

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

Update updates an existing document using the format described in NewDocumentModel() encoded as JSON in the request.

type Store Uses

type Store struct {
    store.Context
    store.DocumentStorer
}

Store provides data access to space category information.

func (Store) Add Uses

func (s Store) Add(ctx domain.RequestContext, d doc.Document) (err error)

Add inserts the given document record into the document table and audits that it has been done.

func (Store) ChangeDocumentSpace Uses

func (s Store) ChangeDocumentSpace(ctx domain.RequestContext, document, space string) (err error)

ChangeDocumentSpace assigns the specified space to the document.

func (Store) Delete Uses

func (s Store) Delete(ctx domain.RequestContext, documentID string) (rows int64, err error)

Delete removes the specified document. Remove document pages, revisions, attachments, updates the search subsystem.

func (Store) DeleteBySpace Uses

func (s Store) DeleteBySpace(ctx domain.RequestContext, spaceID string) (rows int64, err error)

DeleteBySpace removes all documents for given space. Remove document pages, revisions, attachments, updates the search subsystem.

func (Store) Get Uses

func (s Store) Get(ctx domain.RequestContext, id string) (document doc.Document, err error)

Get fetches the document record with the given id fromt the document table and audits that it has been got.

func (Store) GetBySpace Uses

func (s Store) GetBySpace(ctx domain.RequestContext, spaceID string) (documents []doc.Document, err error)

GetBySpace returns a slice containing the documents for a given space.

No attempt is made to hide documents that are protected by category permissions hence caller must filter as required.

All versions of a document are returned, hence caller must decide what to do with them.

func (Store) GetVersions Uses

func (s Store) GetVersions(ctx domain.RequestContext, groupID string) (v []doc.Version, err error)

GetVersions returns a slice containing the documents for a given space.

No attempt is made to hide documents that are protected by category permissions hence caller must filter as required.

All versions of a document are returned, hence caller must decide what to do with them.

func (Store) MoveActivity Uses

func (s Store) MoveActivity(ctx domain.RequestContext, documentID, oldSpaceID, newSpaceID string) (err error)

MoveActivity changes the space for all document activity records.

func (Store) MoveDocumentSpace Uses

func (s Store) MoveDocumentSpace(ctx domain.RequestContext, id, move string) (err error)

MoveDocumentSpace changes the space for client's organization's documents which have space "id", to "move".

func (Store) PublicDocuments Uses

func (s Store) PublicDocuments(ctx domain.RequestContext, orgID string) (documents []doc.SitemapDocument, err error)

PublicDocuments returns a slice of SitemapDocument records linking to documents in public spaces. These documents can then be seen by search crawlers.

func (Store) TemplatesBySpace Uses

func (s Store) TemplatesBySpace(ctx domain.RequestContext, spaceID string) (documents []doc.Document, err error)

TemplatesBySpace returns a slice containing the documents available as templates for given space.

func (Store) Update Uses

func (s Store) Update(ctx domain.RequestContext, document doc.Document) (err error)

Update changes the given document record to the new values, updates search information and audits the action.

func (Store) UpdateGroup Uses

func (s Store) UpdateGroup(ctx domain.RequestContext, d doc.Document) (err error)

UpdateGroup applies same values to all documents with the same group ID.

func (Store) UpdateRevised Uses

func (s Store) UpdateRevised(ctx domain.RequestContext, docID string) (err error)

UpdateRevised sets document revision date to UTC now.

Package document imports 32 packages (graph) and is imported by 2 packages. Updated 2019-11-12. Refresh now. Tools for package owners.