1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-18 20:59: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:
HarveyKandola 2018-09-27 15:14:48 +01:00
parent b455e5eaf5
commit 97beb3f4d3
81 changed files with 1454 additions and 1497 deletions

View file

@ -25,13 +25,14 @@ import (
"github.com/documize/community/domain"
"github.com/documize/community/domain/auth"
"github.com/documize/community/domain/organization"
"github.com/documize/community/domain/store"
"github.com/documize/community/domain/user"
"github.com/documize/community/model/org"
)
type middleware struct {
Runtime *env.Runtime
Store *domain.Store
Store *store.Store
}
func (m *middleware) cors(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {

View file

@ -15,7 +15,6 @@ import (
"net/http"
"github.com/documize/community/core/env"
"github.com/documize/community/domain"
"github.com/documize/community/domain/attachment"
"github.com/documize/community/domain/auth"
"github.com/documize/community/domain/auth/keycloak"
@ -35,13 +34,14 @@ import (
"github.com/documize/community/domain/section"
"github.com/documize/community/domain/setting"
"github.com/documize/community/domain/space"
"github.com/documize/community/domain/store"
"github.com/documize/community/domain/template"
"github.com/documize/community/domain/user"
"github.com/documize/community/server/web"
)
// RegisterEndpoints register routes for serving API endpoints
func RegisterEndpoints(rt *env.Runtime, s *domain.Store) {
func RegisterEndpoints(rt *env.Runtime, s *store.Store) {
// base services
indexer := search.NewIndexer(rt, s)
@ -120,12 +120,12 @@ func RegisterEndpoints(rt *env.Runtime, s *domain.Store) {
AddPrivate(rt, "documents/{documentID}/pages/{pageID}/meta", []string{"GET", "OPTIONS"}, nil, page.GetMeta)
AddPrivate(rt, "documents/{documentID}/pages/{pageID}/copy/{targetID}", []string{"POST", "OPTIONS"}, nil, page.Copy)
AddPrivate(rt, "organization/setting", []string{"GET", "OPTIONS"}, nil, organization.GetGlobalSetting)
AddPrivate(rt, "organization/setting", []string{"POST", "OPTIONS"}, nil, organization.SaveGlobalSetting)
AddPrivate(rt, "organization/setting", []string{"GET", "OPTIONS"}, nil, setting.GetGlobalSetting)
AddPrivate(rt, "organization/setting", []string{"POST", "OPTIONS"}, nil, setting.SaveGlobalSetting)
AddPrivate(rt, "organization/{orgID}", []string{"GET", "OPTIONS"}, nil, organization.Get)
AddPrivate(rt, "organization/{orgID}", []string{"PUT", "OPTIONS"}, nil, organization.Update)
AddPrivate(rt, "organization/{orgID}/setting", []string{"GET", "OPTIONS"}, nil, organization.GetInstanceSetting)
AddPrivate(rt, "organization/{orgID}/setting", []string{"POST", "OPTIONS"}, nil, organization.SaveInstanceSetting)
AddPrivate(rt, "organization/{orgID}/setting", []string{"GET", "OPTIONS"}, nil, setting.GetInstanceSetting)
AddPrivate(rt, "organization/{orgID}/setting", []string{"POST", "OPTIONS"}, nil, setting.SaveInstanceSetting)
AddPrivate(rt, "space/{spaceID}", []string{"DELETE", "OPTIONS"}, nil, space.Delete)
AddPrivate(rt, "space/{spaceID}/move/{moveToId}", []string{"DELETE", "OPTIONS"}, nil, space.Remove)

View file

@ -20,7 +20,7 @@ import (
"github.com/documize/community/core/api/plugins"
"github.com/documize/community/core/database"
"github.com/documize/community/core/env"
"github.com/documize/community/domain"
"github.com/documize/community/domain/store"
"github.com/documize/community/server/routing"
"github.com/documize/community/server/web"
"github.com/gorilla/mux"
@ -29,7 +29,7 @@ import (
var testHost string // used during automated testing
// Start router to handle all HTTP traffic.
func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
func Start(rt *env.Runtime, s *store.Store, ready chan struct{}) {
rt.Log.Info(fmt.Sprintf("Product: %s version %s", rt.Product.Title, rt.Product.Version))
// decide which mode to serve up

View file

@ -18,7 +18,7 @@ import (
"github.com/documize/community/core/env"
"github.com/documize/community/core/secrets"
"github.com/documize/community/domain"
"github.com/documize/community/domain/store"
)
// SiteInfo describes set-up information about the site
@ -33,7 +33,7 @@ func init() {
// Handler contains the runtime information such as logging and database.
type Handler struct {
Runtime *env.Runtime
Store *domain.Store
Store *store.Store
}
// EmberHandler serves HTML web pages