Skip to content

Commit e53746e

Browse files
committed
add documentation to dots_registers_delete.xqm
1 parent c26bf4a commit e53746e

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

repo/backend/dots_registers_delete.xqm

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
xquery version "3.1";
1+
xquery version "4.0";
22

3-
(:~
4-
: Ce module permet à un utilisateur de DoTS de supprimer les registres DoTS du projet de son choix
5-
: @author École nationale des chartes
6-
: @since 2023-10-12
7-
: @version 1.0
3+
(:~
4+
: Module to delete DoTS project registers from a specified database.
5+
: This module allows a DoTS user to:
6+
: - remove the project entry from the central "dots" database (dots_db_switcher.xml),
7+
: - optionally delete the entire project database, or just its DoTS registers
8+
: ("resources.xml" and "fragments.xml").
9+
: Author: École nationale des chartes
10+
: Since: 2023-10-12
11+
: Version: 1.0
812
:)
913
module namespace dots.delete = "backend/dots_registers_delete";
1014

@@ -13,11 +17,26 @@ import module namespace G = "globals";
1317
declare default element namespace "https://github.com/chartes/dots/";
1418
declare namespace dct = "http://purl.org/dc/terms/";
1519

20+
(:~
21+
: Deletes DoTS registers for a given project.
22+
: @param $dbName Name of the project database.
23+
: @param $option If "true", the entire database is dropped.
24+
: If not, only the registers ("resources.xml" and "fragments.xml") are deleted.
25+
: @return Performs update operations in the "dots" database and optionally removes the project database.
26+
:)
1627
declare updating function dots.delete:handle($dbName as xs:string, $option as xs:string) {
1728
dots.delete:dbSwitch($dbName),
1829
dots.delete:registers($dbName, $option)
1930
};
2031

32+
(:~
33+
: Updates the database "dots" by:
34+
: - updating the modification timestamp,
35+
: - decrementing the total number of projects,
36+
: - removing the <member> entry corresponding to the given database name.
37+
: @param $dbName name of the project database to remove from the registry.
38+
: @return updates the <dbSwitch> document in the "dots" database.
39+
:)
2140
declare %private updating function dots.delete:dbSwitch($dbName as xs:string) {
2241
let $dbDots := db:get($G:dots)/dbSwitch
2342
let $totalProjects := $dbDots//totalProjects
@@ -30,6 +49,12 @@ declare %private updating function dots.delete:dbSwitch($dbName as xs:string) {
3049
)
3150
};
3251

52+
(:~
53+
: Deletes the DoTS registers or the entire database depending on the option.
54+
: @param $dbName name of the database to operate on.
55+
: @param $option if "true", deletes the full database. Otherwise, only the registers are deleted.
56+
: @return executes deletion operations accordingly.
57+
:)
3358
declare %private updating function dots.delete:registers($dbName as xs:string, $option as xs:string) {
3459
if ($option = "true") then (
3560
db:drop($dbName)

0 commit comments

Comments
 (0)