mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
[WIP] Provide system restore facility
Co-Authored-By: Harvey Kandola <harvey@documize.com>
This commit is contained in:
parent
71a2860716
commit
516140dd7e
12 changed files with 597 additions and 51 deletions
|
@ -20,6 +20,7 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/documize/community/core/env"
|
||||
"github.com/documize/community/core/event"
|
||||
|
@ -102,6 +103,9 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
|||
sp.UserID = ctx.UserID
|
||||
sp.Type = space.ScopePrivate
|
||||
sp.Lifecycle = wf.LifecycleLive
|
||||
sp.UserID = ctx.UserID
|
||||
sp.Created = time.Now().UTC()
|
||||
sp.Revised = time.Now().UTC()
|
||||
|
||||
err = h.Store.Space.Add(ctx, sp)
|
||||
if err != nil {
|
||||
|
|
|
@ -31,6 +31,9 @@ func TestSpace(t *testing.T) {
|
|||
sp.UserID = ctx.UserID
|
||||
sp.Type = space.ScopePublic
|
||||
sp.Name = "PublicTestSpace"
|
||||
sp.UserID = ctx.UserID
|
||||
sp.Created = time.Now().UTC()
|
||||
sp.Revised = time.Now().UTC()
|
||||
|
||||
err = s.Space.Add(ctx, sp)
|
||||
if err != nil {
|
||||
|
@ -98,6 +101,9 @@ func TestSpace(t *testing.T) {
|
|||
sp2.OrgID = ctx.OrgID
|
||||
sp2.Type = space.ScopePrivate
|
||||
sp2.Name = "PrivateTestSpace"
|
||||
sp.UserID = ctx.UserID
|
||||
sp.Created = time.Now().UTC()
|
||||
sp.Revised = time.Now().UTC()
|
||||
|
||||
err = s.Space.Add(ctx, sp2)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,10 +30,6 @@ type Store struct {
|
|||
|
||||
// Add adds new folder into the store.
|
||||
func (s Store) Add(ctx domain.RequestContext, sp space.Space) (err error) {
|
||||
sp.UserID = ctx.UserID
|
||||
sp.Created = time.Now().UTC()
|
||||
sp.Revised = time.Now().UTC()
|
||||
|
||||
_, err = ctx.Transaction.Exec(s.Bind("INSERT INTO dmz_space (c_refid, c_name, c_orgid, c_userid, c_type, c_lifecycle, c_likes, c_created, c_revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"),
|
||||
sp.RefID, sp.Name, sp.OrgID, sp.UserID, sp.Type, sp.Lifecycle, sp.Likes, sp.Created, sp.Revised)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue