@@ -4,6 +4,12 @@ import { getInputModelsOrError } from "../utils/prepInputModels.js";
44
55const dicome = Router ( ) ;
66
7+ /**
8+ * Compare two models and detect conflicts
9+ *
10+ * @param {InputModels } req.body - The first operand
11+ * @returns {DiffModel } The sum of both operands
12+ */
713dicome . post ( "/compare" , ( req , res ) => {
814 console . log ( "request body" , req . body ) ;
915 const inputModelsOrError = getInputModelsOrError ( req . body , req . session ) ;
@@ -18,22 +24,28 @@ dicome.post("/compare", (req, res) => {
1824 }
1925} ) ;
2026
21- dicome . put ( "/apply/ltr" , ( req , res ) => {
27+ /**
28+ * Apply differences
29+ *
30+ * for conflicts: if this is a left change then right automatically rejected and vis a versa
31+ *
32+ * @param {number[] } req.body - list of the IDs of 1-n changes to apply
33+ * @returns {object } JSON patch (if technically possible) of diff model and left/right
34+ */
35+ dicome . put ( "/apply" , ( req , res ) => {
2236 // TODO
2337 res . sendStatus ( 200 ) ;
2438} ) ;
2539
26- dicome . put ( "/apply/rtl" , ( req , res ) => {
27- // TODO
28- res . sendStatus ( 200 ) ;
29- } ) ;
30-
31- dicome . put ( "/accept" , ( req , res ) => {
32- // TODO
33- res . sendStatus ( 200 ) ;
34- } ) ;
35-
36- dicome . put ( "/reject" , ( req , res ) => {
40+ /**
41+ * Discard differences
42+ *
43+ * for conflicts: if this is a left change then right automatically accepted and vis a versa
44+ *
45+ * @param {number[] } req.body - list of the IDs of 1-n changes to discard
46+ * @returns {object } JSON patch (if technically possible) of diff model and left/right
47+ */
48+ dicome . put ( "/discard" , ( req , res ) => {
3749 // TODO
3850 res . sendStatus ( 200 ) ;
3951} ) ;
0 commit comments