@@ -1236,6 +1236,29 @@ async function _addOneHandler(
1236
1236
Log
1237
1237
)
1238
1238
}
1239
+
1240
+ try {
1241
+ if (
1242
+ ownerModel . routeOptions &&
1243
+ ownerModel . routeOptions . add &&
1244
+ ownerModel . routeOptions . add [ associationName ] &&
1245
+ ownerModel . routeOptions . add [ associationName ] . post
1246
+ ) {
1247
+ await ownerModel . routeOptions . add [ associationName ] . post (
1248
+ payload ,
1249
+ request ,
1250
+ Log
1251
+ )
1252
+ }
1253
+ } catch ( err ) {
1254
+ handleError (
1255
+ err ,
1256
+ 'There was a postprocessing error after setting the association.' ,
1257
+ Boom . badRequest ,
1258
+ Log
1259
+ )
1260
+ }
1261
+
1239
1262
return true
1240
1263
} else {
1241
1264
throw Boom . notFound ( 'No resource was found with that id.' )
@@ -1432,6 +1455,29 @@ async function _removeOneHandler(
1432
1455
Log
1433
1456
)
1434
1457
}
1458
+
1459
+ try {
1460
+ if (
1461
+ ownerModel . routeOptions &&
1462
+ ownerModel . routeOptions . remove &&
1463
+ ownerModel . routeOptions . remove [ associationName ] &&
1464
+ ownerModel . routeOptions . remove [ associationName ] . post
1465
+ ) {
1466
+ await ownerModel . routeOptions . remove [ associationName ] . post (
1467
+ { } ,
1468
+ request ,
1469
+ Log
1470
+ )
1471
+ }
1472
+ } catch ( err ) {
1473
+ handleError (
1474
+ err ,
1475
+ 'There was a postprocessing error after removing the association.' ,
1476
+ Boom . badRequest ,
1477
+ Log
1478
+ )
1479
+ }
1480
+
1435
1481
return true
1436
1482
} else {
1437
1483
throw Boom . notFound ( 'No resource was found with that id.' )
@@ -1643,6 +1689,29 @@ async function _addManyHandler(
1643
1689
)
1644
1690
}
1645
1691
}
1692
+
1693
+ try {
1694
+ if (
1695
+ ownerModel . routeOptions &&
1696
+ ownerModel . routeOptions . add &&
1697
+ ownerModel . routeOptions . add [ associationName ] &&
1698
+ ownerModel . routeOptions . add [ associationName ] . post
1699
+ ) {
1700
+ await ownerModel . routeOptions . add [ associationName ] . post (
1701
+ payload ,
1702
+ request ,
1703
+ Log
1704
+ )
1705
+ }
1706
+ } catch ( err ) {
1707
+ handleError (
1708
+ err ,
1709
+ 'There was a postprocessing error after setting the associations.' ,
1710
+ Boom . badRequest ,
1711
+ Log
1712
+ )
1713
+ }
1714
+
1646
1715
return true
1647
1716
} else {
1648
1717
throw Boom . notFound ( 'No owner resource was found with that id.' )
@@ -1812,7 +1881,7 @@ async function _removeManyHandler(
1812
1881
} catch ( err ) {
1813
1882
handleError (
1814
1883
err ,
1815
- 'There was a preprocessing error while removing the association .' ,
1884
+ 'There was a preprocessing error while removing the associations .' ,
1816
1885
Boom . badRequest ,
1817
1886
Log
1818
1887
)
@@ -1837,6 +1906,29 @@ async function _removeManyHandler(
1837
1906
)
1838
1907
}
1839
1908
}
1909
+
1910
+ try {
1911
+ if (
1912
+ ownerModel . routeOptions &&
1913
+ ownerModel . routeOptions . remove &&
1914
+ ownerModel . routeOptions . remove [ associationName ] &&
1915
+ ownerModel . routeOptions . remove [ associationName ] . post
1916
+ ) {
1917
+ await ownerModel . routeOptions . remove [ associationName ] . post (
1918
+ payload ,
1919
+ request ,
1920
+ Log
1921
+ )
1922
+ }
1923
+ } catch ( err ) {
1924
+ handleError (
1925
+ err ,
1926
+ 'There was a postprocessing error after removing the associations.' ,
1927
+ Boom . badRequest ,
1928
+ Log
1929
+ )
1930
+ }
1931
+
1840
1932
return true
1841
1933
} else {
1842
1934
throw Boom . notFound ( 'No owner resource was found with that id.' )
0 commit comments