|
|
@@ -284,17 +284,14 @@ sub get_page_image { |
|
|
|
sub api_v1_POST_documents { |
|
|
|
my($id, $qs, $post, $user) = @_; |
|
|
|
|
|
|
|
$id = gen_uuid(); |
|
|
|
my $docid; |
|
|
|
|
|
|
|
my $q = sqlquery($dbh, " |
|
|
|
INSERT INTO documents |
|
|
|
SET |
|
|
|
id = ?, |
|
|
|
owner = ?, |
|
|
|
status = 'nodata' |
|
|
|
", $id, $user); |
|
|
|
my $q = sqlquery($dbh, "CALL create_document(?)", $user); |
|
|
|
while(my($id) = $q->fetchrow_array()) { |
|
|
|
$docid = $id; |
|
|
|
} |
|
|
|
|
|
|
|
return db_get_document_object($id); |
|
|
|
return db_get_document_object($docid); |
|
|
|
} |
|
|
|
|
|
|
|
sub api_v1_POST_documents_id_data { |
|
|
@@ -322,7 +319,7 @@ sub api_v1_GET_documents_id_image { |
|
|
|
|
|
|
|
my $pageid; |
|
|
|
|
|
|
|
my $q = sqlquery($dbh, "SELECT id FROM pages WHERE documentId = ? ORDER BY id DESC LIMIT 1", $id); |
|
|
|
my $q = sqlquery($dbh, "CALL get_primary_page(?)", $id); |
|
|
|
while(my($myid)=$q->fetchrow_array()) { |
|
|
|
$pageid = $myid; |
|
|
|
} |
|
|
@@ -384,7 +381,7 @@ sub api_v1_PATCH_documents_id { |
|
|
|
my $tags = get_array($qs->{addTags}); |
|
|
|
|
|
|
|
foreach my $tag ( @{$tags} ) { |
|
|
|
sqlquery($dbh, "CALL tag_add(?,?)", $id, $tag); |
|
|
|
sqlquery($dbh, "CALL add_tag(?,?)", $id, $tag); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -392,7 +389,7 @@ sub api_v1_PATCH_documents_id { |
|
|
|
my $tags = get_array($qs->{deleteTags}); |
|
|
|
|
|
|
|
foreach my $tag ( @{$tags} ) { |
|
|
|
sqlquery($dbh, "CALL tag_del(?,?)", $id, $tag); |
|
|
|
sqlquery($dbh, "CALL delete_tag(?,?)", $id, $tag); |
|
|
|
} |
|
|
|
} |
|
|
|
|