mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
Make API work with new schema
This commit is contained in:
parent
28342fcf5e
commit
4f0cc2f616
48 changed files with 1218 additions and 1097 deletions
|
@ -80,11 +80,11 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) {
|
|||
if p.RefID != pageID {
|
||||
c := link.Candidate{
|
||||
RefID: uniqueid.Generate(),
|
||||
FolderID: folderID,
|
||||
SpaceID: folderID,
|
||||
DocumentID: documentID,
|
||||
TargetID: p.RefID,
|
||||
LinkType: p.PageType,
|
||||
Title: p.Title,
|
||||
LinkType: p.Type,
|
||||
Title: p.Name,
|
||||
}
|
||||
pc = append(pc, c)
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) {
|
|||
for _, f := range files {
|
||||
c := link.Candidate{
|
||||
RefID: uniqueid.Generate(),
|
||||
FolderID: folderID,
|
||||
SpaceID: folderID,
|
||||
DocumentID: documentID,
|
||||
TargetID: f.RefID,
|
||||
LinkType: "file",
|
||||
|
|
|
@ -60,7 +60,7 @@ func getLink(t html.Token) (ok bool, link link.Link) {
|
|||
case "data-link-id":
|
||||
link.RefID = strings.TrimSpace(a.Val)
|
||||
case "data-link-space-id":
|
||||
link.FolderID = strings.TrimSpace(a.Val)
|
||||
link.SpaceID = strings.TrimSpace(a.Val)
|
||||
case "data-link-target-document-id":
|
||||
link.TargetDocumentID = strings.TrimSpace(a.Val)
|
||||
case "data-link-target-id":
|
||||
|
|
|
@ -37,7 +37,7 @@ func (s Scope) Add(ctx domain.RequestContext, l link.Link) (err error) {
|
|||
l.Revised = time.Now().UTC()
|
||||
|
||||
_, err = ctx.Transaction.Exec("INSERT INTO dmz_doc_link (c_refid, c_orgid, c_spaceid, c_userid, c_sourcedocid, c_sourcesectionid, c_targetdocid, c_targetid, c_externalid, c_type, c_orphan, c_created, c_revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
l.RefID, l.OrgID, l.FolderID, l.UserID, l.SourceDocumentID, l.SourceSectionID, l.TargetDocumentID, l.TargetID, l.ExternalID, l.LinkType, l.Orphan, l.Created, l.Revised)
|
||||
l.RefID, l.OrgID, l.SpaceID, l.UserID, l.SourceDocumentID, l.SourceSectionID, l.TargetDocumentID, l.TargetID, l.ExternalID, l.LinkType, l.Orphan, l.Created, l.Revised)
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "execute link insert")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue