mirror of
https://github.com/documize/community.git
synced 2025-07-23 07:09:43 +02:00
Continued MySQL/PostgreSQL store provider refactoring
Refactored, renamed, removed storage related code. Basic smoke test passed for PostgreSQL whilst fully working on MySQL variants as per usual.
This commit is contained in:
parent
b455e5eaf5
commit
97beb3f4d3
81 changed files with 1454 additions and 1497 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
|
||||
"github.com/documize/community/domain"
|
||||
"github.com/documize/community/domain/permission"
|
||||
"github.com/documize/community/domain/store"
|
||||
"github.com/documize/community/model/doc"
|
||||
"github.com/documize/community/model/page"
|
||||
pm "github.com/documize/community/model/permission"
|
||||
|
@ -39,7 +40,7 @@ type exportTOC struct {
|
|||
}
|
||||
|
||||
// BuildExport generates self-enclosed HTML for content specified.
|
||||
func BuildExport(ctx domain.RequestContext, s domain.Store, spec exportSpec) (html string, err error) {
|
||||
func BuildExport(ctx domain.RequestContext, s store.Store, spec exportSpec) (html string, err error) {
|
||||
export := strings.Builder{}
|
||||
content := strings.Builder{}
|
||||
toc := []exportTOC{}
|
||||
|
@ -114,7 +115,7 @@ func BuildExport(ctx domain.RequestContext, s domain.Store, spec exportSpec) (ht
|
|||
}
|
||||
|
||||
// exportSpace returns documents exported.
|
||||
func exportSpace(ctx domain.RequestContext, s domain.Store, spaceID string) (toc []exportTOC, export string, err error) {
|
||||
func exportSpace(ctx domain.RequestContext, s store.Store, spaceID string) (toc []exportTOC, export string, err error) {
|
||||
// Permission check.
|
||||
if !permission.CanViewSpace(ctx, s, spaceID) {
|
||||
return toc, "", nil
|
||||
|
@ -164,7 +165,7 @@ func exportSpace(ctx domain.RequestContext, s domain.Store, spaceID string) (toc
|
|||
}
|
||||
|
||||
// exportCategory returns documents exported for selected categories.
|
||||
func exportCategory(ctx domain.RequestContext, s domain.Store, spaceID string, category []string) (toc []exportTOC, export string, err error) {
|
||||
func exportCategory(ctx domain.RequestContext, s store.Store, spaceID string, category []string) (toc []exportTOC, export string, err error) {
|
||||
// Permission check.
|
||||
if !permission.CanViewSpace(ctx, s, spaceID) {
|
||||
return toc, "", nil
|
||||
|
@ -232,7 +233,7 @@ func exportCategory(ctx domain.RequestContext, s domain.Store, spaceID string, c
|
|||
}
|
||||
|
||||
// exportDocument returns documents for export.
|
||||
func exportDocument(ctx domain.RequestContext, s domain.Store, spaceID string, document []string) (toc []exportTOC, export string, err error) {
|
||||
func exportDocument(ctx domain.RequestContext, s store.Store, spaceID string, document []string) (toc []exportTOC, export string, err error) {
|
||||
// Permission check.
|
||||
if !permission.CanViewSpace(ctx, s, spaceID) {
|
||||
return toc, "", nil
|
||||
|
@ -288,7 +289,7 @@ func exportDocument(ctx domain.RequestContext, s domain.Store, spaceID string, d
|
|||
}
|
||||
|
||||
// processDocument writes out document as HTML content
|
||||
func processDocument(ctx domain.RequestContext, s domain.Store, documentID string) (export string, err error) {
|
||||
func processDocument(ctx domain.RequestContext, s store.Store, documentID string) (export string, err error) {
|
||||
b := strings.Builder{}
|
||||
|
||||
// Permission check.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue