@raclettejs/core 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/package.json +2 -2
- package/services/backend/src/core/backgroundTasks/taskManager.ts +1 -1
- package/services/backend/src/core/sockets/socketManager.ts +2 -0
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/account.service.ts +7 -3
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/routes/route.account.hardDelete.ts +16 -11
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/composition.service.ts +9 -3
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/routes/route.composition.hardDelete.ts +16 -11
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/interactionLink.service.ts +12 -6
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/routes/route.interactionLink.hardDelete.ts +14 -7
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/project/project.service.ts +8 -4
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/routes/route.tag.hardDelete.ts +14 -7
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/tag.service.ts +10 -3
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/routes/index.ts +2 -0
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/routes/route.user.hardDelete.ts +55 -0
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/user.service.ts +32 -0
- package/services/frontend/src/core/lib/data/fetchDataHandler.ts +22 -14
- package/services/frontend/src/core/lib/data/responseTypeHandler.ts +1 -1
- package/services/frontend/src/core/lib/userNotifier.ts +2 -1
- package/yarn.lock +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,15 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
## [0.1.
|
|
10
|
+
## [0.1.17] - 06.11.2025 <a href="https://gitlab.com/raclettejs/core/-/compare/v0.1.15...v0.1.17" target="_blank" rel="noopener"><b>Overview of all changes</b></a>
|
|
11
11
|
|
|
12
12
|
### Fixed
|
|
13
13
|
|
|
14
14
|
- Frontend: axios Delete handling
|
|
15
|
+
- Frontend: retrieval of deleted compositions/interactionLinks during socket join
|
|
16
|
+
- Frontend: notifications for delete events now show name
|
|
17
|
+
-
|
|
15
18
|
|
|
16
19
|
### Added
|
|
17
20
|
|
|
18
21
|
- Frontend: added i18n keys
|
|
22
|
+
- Frontend: hard delete of core datatypes
|
|
19
23
|
- Backend: getAll routes for core datatypes do now respect set filters
|
|
20
24
|
|
|
21
25
|
## [0.1.15] - 02.11.2025 <a href="https://gitlab.com/raclettejs/core/-/compare/v0.1.13...v0.1.15" target="_blank" rel="noopener"><b>Overview of all changes</b></a>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raclettejs/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "racletteJS core package",
|
|
5
5
|
"repository": "https://gitlab.com/raclettejs/core",
|
|
6
6
|
"author": "Pacifico Digital Explorations GmbH <info@raclettejs.com>",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@eslint/js": "9.35.0",
|
|
72
|
-
"@raclettejs/types": "0.1.
|
|
72
|
+
"@raclettejs/types": "^0.1.17",
|
|
73
73
|
"@types/fs-extra": "11.0.4",
|
|
74
74
|
"@types/js-yaml": "4.0.9",
|
|
75
75
|
"@types/node": "24.5.1",
|
|
@@ -122,7 +122,7 @@ const setupTaskManager = (fastify: FastifyInstance) => {
|
|
|
122
122
|
|
|
123
123
|
if (removed) {
|
|
124
124
|
taskMetadata.delete(name)
|
|
125
|
-
fastify.log.info(`
|
|
125
|
+
fastify.log.info(`Canceled task: ${name}`)
|
|
126
126
|
} else {
|
|
127
127
|
fastify.log.warn(`Task not found: ${name}`)
|
|
128
128
|
}
|
|
@@ -93,6 +93,7 @@ const registerSocketEvents = (fastify: FastifyInstance): void => {
|
|
|
93
93
|
"composition",
|
|
94
94
|
"readAll",
|
|
95
95
|
fastify,
|
|
96
|
+
{ isDeleted: false },
|
|
96
97
|
)
|
|
97
98
|
}
|
|
98
99
|
|
|
@@ -103,6 +104,7 @@ const registerSocketEvents = (fastify: FastifyInstance): void => {
|
|
|
103
104
|
"interactionLink",
|
|
104
105
|
"readAll",
|
|
105
106
|
fastify,
|
|
107
|
+
{ isDeleted: false },
|
|
106
108
|
)
|
|
107
109
|
}
|
|
108
110
|
|
package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/account.service.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
import type { PluginFastifyInstance } from "types"
|
|
7
7
|
import { v4 as uuidv4, validate } from "uuid"
|
|
8
8
|
import { createAccountPayload } from "./helpers/payload"
|
|
9
|
-
import { Model } from "mongoose"
|
|
9
|
+
import type { Model } from "mongoose"
|
|
10
10
|
|
|
11
11
|
export type AccountBody = Partial<Omit<AccountType, "_id">> & {
|
|
12
12
|
_id?: string
|
|
@@ -277,9 +277,13 @@ export class AccountService {
|
|
|
277
277
|
)
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
await
|
|
280
|
+
const res = await account.deleteOne()
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
if (res?.deletedCount === 1) {
|
|
283
|
+
return account.toObject ? account.toObject() : account
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
throw new Error(`Deletion of Account with ID ${id} was not successful.`)
|
|
283
287
|
} catch (error: any) {
|
|
284
288
|
fastify.log.error(error.message)
|
|
285
289
|
throw error
|
|
@@ -2,6 +2,7 @@ import type { Static } from "@sinclair/typebox"
|
|
|
2
2
|
import type { FastifyReply, FastifyRequest } from "fastify"
|
|
3
3
|
import type { PluginFastifyInstance } from "types"
|
|
4
4
|
import { Type } from "@sinclair/typebox"
|
|
5
|
+
import { ForbiddenError } from "@/utils/errors"
|
|
5
6
|
|
|
6
7
|
const ParamsSchema = Type.Object({
|
|
7
8
|
_id: Type.String(),
|
|
@@ -17,19 +18,23 @@ export default (fastify: PluginFastifyInstance) => {
|
|
|
17
18
|
}>,
|
|
18
19
|
reply: FastifyReply,
|
|
19
20
|
) => {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (req.user.isAdmin) {
|
|
22
|
+
try {
|
|
23
|
+
const { _id } = req.params
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const payload = await accountService.hardDeleteAccount(
|
|
26
|
+
fastify,
|
|
27
|
+
req.requestParams,
|
|
28
|
+
_id,
|
|
29
|
+
)
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
return payload
|
|
32
|
+
} catch (error: any) {
|
|
33
|
+
fastify.log.error(error.message)
|
|
34
|
+
return reply.internalServerError(error.message)
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
throw new ForbiddenError("Only admins can hard delete this core datatype")
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
|
|
@@ -292,7 +292,7 @@ export class CompositionService {
|
|
|
292
292
|
): Promise<CompositionType> {
|
|
293
293
|
try {
|
|
294
294
|
const composition = await this.compositionModel.findOne({
|
|
295
|
-
id,
|
|
295
|
+
_id: id,
|
|
296
296
|
isDeleted: true,
|
|
297
297
|
})
|
|
298
298
|
|
|
@@ -302,9 +302,15 @@ export class CompositionService {
|
|
|
302
302
|
)
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
await
|
|
305
|
+
const res = await composition.deleteOne()
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
if (res?.deletedCount === 1) {
|
|
308
|
+
return composition.toObject ? composition.toObject() : composition
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
throw new Error(
|
|
312
|
+
`Deletion of Composition with ID ${id} was not successful.`,
|
|
313
|
+
)
|
|
308
314
|
} catch (error: any) {
|
|
309
315
|
fastify.log.error(error.message)
|
|
310
316
|
throw error
|
|
@@ -2,6 +2,7 @@ import type { Static } from "@sinclair/typebox"
|
|
|
2
2
|
import type { FastifyReply, FastifyRequest } from "fastify"
|
|
3
3
|
import type { PluginFastifyInstance } from "types"
|
|
4
4
|
import { Type } from "@sinclair/typebox"
|
|
5
|
+
import { ForbiddenError } from "@/utils/errors"
|
|
5
6
|
|
|
6
7
|
const ParamsSchema = Type.Object({
|
|
7
8
|
_id: Type.String(),
|
|
@@ -17,19 +18,23 @@ export default (fastify: PluginFastifyInstance) => {
|
|
|
17
18
|
}>,
|
|
18
19
|
reply: FastifyReply,
|
|
19
20
|
) => {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (req.user.isAdmin) {
|
|
22
|
+
try {
|
|
23
|
+
const { _id } = req.params
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const payload = await compositionService.hardDeleteComposition(
|
|
26
|
+
fastify,
|
|
27
|
+
req.requestParams,
|
|
28
|
+
_id,
|
|
29
|
+
)
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
return payload
|
|
32
|
+
} catch (error: any) {
|
|
33
|
+
fastify.log.error(error.message)
|
|
34
|
+
return reply.internalServerError(error.message)
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
throw new ForbiddenError("Only admins can hard delete this core datatype")
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
|
|
@@ -5,8 +5,8 @@ import type {
|
|
|
5
5
|
} from "@c/payload/payloadTypes"
|
|
6
6
|
import { v4 as uuidv4, validate } from "uuid"
|
|
7
7
|
import { createInteractionLinkPayload } from "./helpers/payload"
|
|
8
|
-
import { PluginFastifyInstance } from "types"
|
|
9
|
-
import { Model } from "mongoose"
|
|
8
|
+
import type { PluginFastifyInstance } from "types"
|
|
9
|
+
import type { Model } from "mongoose"
|
|
10
10
|
|
|
11
11
|
export type InteractionLinkBody = Partial<Omit<InteractionLinkType, "_id">> & {
|
|
12
12
|
_id?: string
|
|
@@ -352,11 +352,17 @@ export class InteractionLinkService {
|
|
|
352
352
|
)
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
await
|
|
355
|
+
const res = await interactionLink.deleteOne()
|
|
356
356
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
357
|
+
if (res?.deletedCount === 1) {
|
|
358
|
+
return interactionLink.toObject
|
|
359
|
+
? interactionLink.toObject()
|
|
360
|
+
: interactionLink
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
throw new Error(
|
|
364
|
+
`Deletion of InteractionLink with ID ${id} was not successful.`,
|
|
365
|
+
)
|
|
360
366
|
} catch (error: any) {
|
|
361
367
|
fastify.log.error(error.message)
|
|
362
368
|
throw error
|
|
@@ -2,6 +2,7 @@ import type { Static } from "@sinclair/typebox"
|
|
|
2
2
|
import type { FastifyReply, FastifyRequest } from "fastify"
|
|
3
3
|
import { PluginFastifyInstance } from "types"
|
|
4
4
|
import { Type } from "@sinclair/typebox"
|
|
5
|
+
import { ForbiddenError } from "@/utils/errors"
|
|
5
6
|
|
|
6
7
|
const ParamsSchema = Type.Object({
|
|
7
8
|
_id: Type.String(),
|
|
@@ -18,15 +19,21 @@ export default (fastify: PluginFastifyInstance) => {
|
|
|
18
19
|
reply: FastifyReply,
|
|
19
20
|
) => {
|
|
20
21
|
try {
|
|
21
|
-
|
|
22
|
+
if (req.user.isAdmin) {
|
|
23
|
+
const { _id } = req.params
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const payload = await interactionLinkService.hardDeleteInteractionLink(
|
|
26
|
+
fastify,
|
|
27
|
+
req.requestParams,
|
|
28
|
+
_id,
|
|
29
|
+
)
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
return payload
|
|
32
|
+
} else {
|
|
33
|
+
throw new ForbiddenError(
|
|
34
|
+
"Only admins can hard delete this core datatype",
|
|
35
|
+
)
|
|
36
|
+
}
|
|
30
37
|
} catch (error: any) {
|
|
31
38
|
fastify.log.error(error.message)
|
|
32
39
|
return reply.internalServerError(error.message)
|
package/services/backend/src/corePlugins/raclette__core/backend/datatypes/project/project.service.ts
CHANGED
|
@@ -10,8 +10,8 @@ import type {
|
|
|
10
10
|
import type { QueryOptions } from "@m/database/providers/mongodb/service"
|
|
11
11
|
import { v4 as uuidv4, validate } from "uuid"
|
|
12
12
|
import { createProjectPayload } from "./helpers/payload"
|
|
13
|
-
import { Model } from "mongoose"
|
|
14
|
-
import { PluginFastifyInstance } from "types"
|
|
13
|
+
import type { Model } from "mongoose"
|
|
14
|
+
import type { PluginFastifyInstance } from "types"
|
|
15
15
|
|
|
16
16
|
export type ProjectBody = Partial<Omit<ProjectType, "_id">> & { _id?: string }
|
|
17
17
|
|
|
@@ -316,9 +316,13 @@ export class ProjectService {
|
|
|
316
316
|
)
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
await
|
|
319
|
+
const res = await project.deleteOne()
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
if (res?.deletedCount === 1) {
|
|
322
|
+
return project.toObject ? project.toObject() : project
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
throw new Error(`Deletion of Project with ID ${id} was not successful.`)
|
|
322
326
|
} catch (error: any) {
|
|
323
327
|
fastify.log.error(error.message)
|
|
324
328
|
throw error
|
|
@@ -2,6 +2,7 @@ import type { Static } from "@sinclair/typebox"
|
|
|
2
2
|
import type { FastifyReply, FastifyRequest } from "fastify"
|
|
3
3
|
import { PluginFastifyInstance } from "types"
|
|
4
4
|
import { Type } from "@sinclair/typebox"
|
|
5
|
+
import { ForbiddenError } from "@/utils/errors"
|
|
5
6
|
|
|
6
7
|
const ParamsSchema = Type.Object({
|
|
7
8
|
_id: Type.String(),
|
|
@@ -16,15 +17,21 @@ export default (fastify: PluginFastifyInstance) => {
|
|
|
16
17
|
reply: FastifyReply,
|
|
17
18
|
) => {
|
|
18
19
|
try {
|
|
19
|
-
|
|
20
|
+
if (req.user.isAdmin) {
|
|
21
|
+
const { _id } = req.params
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const payloadWithTag = await tagService.hardDeleteTag(
|
|
24
|
+
fastify,
|
|
25
|
+
req.requestParams,
|
|
26
|
+
_id,
|
|
27
|
+
)
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
return payloadWithTag
|
|
30
|
+
} else {
|
|
31
|
+
throw new ForbiddenError(
|
|
32
|
+
"Only admins can hard delete this core datatype",
|
|
33
|
+
)
|
|
34
|
+
}
|
|
28
35
|
} catch (error: any) {
|
|
29
36
|
fastify.log.error(error.message)
|
|
30
37
|
return reply.internalServerError(error.message)
|
package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/tag.service.ts
CHANGED
|
@@ -318,7 +318,10 @@ export class TagService {
|
|
|
318
318
|
id: string,
|
|
319
319
|
): Promise<TagType> {
|
|
320
320
|
try {
|
|
321
|
-
const tag = await this.tagModel.findOne({
|
|
321
|
+
const tag = await this.tagModel.findOne({
|
|
322
|
+
_id: id,
|
|
323
|
+
isDeleted: true,
|
|
324
|
+
})
|
|
322
325
|
|
|
323
326
|
if (!tag) {
|
|
324
327
|
throw new Error(
|
|
@@ -326,9 +329,13 @@ export class TagService {
|
|
|
326
329
|
)
|
|
327
330
|
}
|
|
328
331
|
|
|
329
|
-
await
|
|
332
|
+
const res = await tag.deleteOne()
|
|
330
333
|
|
|
331
|
-
|
|
334
|
+
if (res?.deletedCount === 1) {
|
|
335
|
+
return tag.toObject ? tag.toObject() : tag
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
throw new Error(`Deletion of Tag with ID ${id} was not successful.`)
|
|
332
339
|
} catch (error: any) {
|
|
333
340
|
fastify.log.error(error.message)
|
|
334
341
|
throw error
|
package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/routes/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import patch from "./route.user.patch"
|
|
|
5
5
|
import patchLastProject from "./route.user.patchLastProject"
|
|
6
6
|
import post from "./route.user.post"
|
|
7
7
|
import remove from "./route.user.remove"
|
|
8
|
+
import hardDelete from "./route.user.hardDelete"
|
|
8
9
|
|
|
9
10
|
const registerRoutes = async (fastify: PluginFastifyInstance) => {
|
|
10
11
|
await fastify.get("/user/all", getAll(fastify))
|
|
@@ -12,6 +13,7 @@ const registerRoutes = async (fastify: PluginFastifyInstance) => {
|
|
|
12
13
|
await fastify.patch("/user/:_id", patch(fastify))
|
|
13
14
|
await fastify.post("/user", post(fastify))
|
|
14
15
|
await fastify.delete("/user/:_id", remove(fastify))
|
|
16
|
+
await fastify.delete("/user/:_id/hard", hardDelete(fastify))
|
|
15
17
|
await fastify.patch(
|
|
16
18
|
"/user/last-project/:projectId",
|
|
17
19
|
patchLastProject(fastify),
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Static } from "@sinclair/typebox"
|
|
2
|
+
import type { FastifyReply, FastifyRequest } from "fastify"
|
|
3
|
+
import { PluginFastifyInstance } from "types"
|
|
4
|
+
import { Type } from "@sinclair/typebox"
|
|
5
|
+
import { ForbiddenError } from "@/utils/errors"
|
|
6
|
+
|
|
7
|
+
const ParamsSchema = Type.Object({
|
|
8
|
+
_id: Type.String(),
|
|
9
|
+
})
|
|
10
|
+
type Params = Static<typeof ParamsSchema>
|
|
11
|
+
|
|
12
|
+
export default (fastify: PluginFastifyInstance) => {
|
|
13
|
+
const userService = fastify.custom.userService
|
|
14
|
+
|
|
15
|
+
const handler = async (
|
|
16
|
+
req: FastifyRequest<{ Params: Params }>,
|
|
17
|
+
reply: FastifyReply,
|
|
18
|
+
) => {
|
|
19
|
+
try {
|
|
20
|
+
if (req.user.isAdmin) {
|
|
21
|
+
const { _id } = req.params
|
|
22
|
+
|
|
23
|
+
const payloadWithUser = await userService.hardDeleteUser(
|
|
24
|
+
fastify,
|
|
25
|
+
req.requestParams,
|
|
26
|
+
_id,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return payloadWithUser
|
|
30
|
+
} else {
|
|
31
|
+
throw new ForbiddenError(
|
|
32
|
+
"Only admins can hard delete this core datatype",
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
} catch (error: any) {
|
|
36
|
+
fastify.log.error(error.message)
|
|
37
|
+
return reply.internalServerError(error.message)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
handler,
|
|
43
|
+
onRequest: [fastify.authenticate],
|
|
44
|
+
config: {
|
|
45
|
+
type: "dataHardDeleted",
|
|
46
|
+
broadcastChannels: ["userHardDeleted"],
|
|
47
|
+
},
|
|
48
|
+
schema: {
|
|
49
|
+
summary: "Permanently delete a user by id",
|
|
50
|
+
description: "Hard delete a user",
|
|
51
|
+
tags: ["core/user"],
|
|
52
|
+
params: ParamsSchema,
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
}
|
package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/user.service.ts
CHANGED
|
@@ -287,6 +287,38 @@ export class UserService {
|
|
|
287
287
|
return payload
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Core function to hard delete an interaction link (returns raw data)
|
|
292
|
+
*/
|
|
293
|
+
async _hardDeleteUser(
|
|
294
|
+
fastify: PluginFastifyInstance,
|
|
295
|
+
id: string,
|
|
296
|
+
): Promise<UserType> {
|
|
297
|
+
try {
|
|
298
|
+
const user = await this.userModel.findOne({
|
|
299
|
+
_id: id,
|
|
300
|
+
isDeleted: true,
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
if (!user) {
|
|
304
|
+
throw new Error(
|
|
305
|
+
`User with ID ${id} not found or not marked for deletion`,
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const res = await user.deleteOne()
|
|
310
|
+
|
|
311
|
+
if (res?.deletedCount === 1) {
|
|
312
|
+
return user.toObject ? user.toObject() : user
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
throw new Error(`Deletion of User with ID ${id} was not successful.`)
|
|
316
|
+
} catch (error: any) {
|
|
317
|
+
fastify.log.error(error.message)
|
|
318
|
+
throw error
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
290
322
|
/**
|
|
291
323
|
* Core function to update user's last accessed project (returns raw data)
|
|
292
324
|
*/
|
|
@@ -164,11 +164,11 @@ const cacheOperations = {
|
|
|
164
164
|
},
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
const finishRemoteQuery = (actionIdentifier, result, params, options) => {
|
|
167
|
+
const finishRemoteQuery = (actionIdentifier, result = {}, params, options) => {
|
|
168
168
|
const { actionId, cacheKey } = actionIdentifier
|
|
169
169
|
log.api("finishRemoteQuery", { actionId, params, result })
|
|
170
170
|
|
|
171
|
-
if (!result
|
|
171
|
+
if (!result?.data) {
|
|
172
172
|
return
|
|
173
173
|
}
|
|
174
174
|
let resultBody = structuredClone(result.data.body)
|
|
@@ -238,18 +238,26 @@ const handleRemoteRequest = async (
|
|
|
238
238
|
const response =
|
|
239
239
|
method === "GET"
|
|
240
240
|
? await $api.axios.get(target, config).catch((e) => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
if (e.name !== "CanceledError") {
|
|
242
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
243
|
+
message: e.response?.data?.message || "error",
|
|
244
|
+
color: "error",
|
|
245
|
+
})
|
|
246
|
+
throw e
|
|
247
|
+
}
|
|
248
|
+
log.api("axios/get/error", e)
|
|
249
|
+
return {}
|
|
246
250
|
})
|
|
247
251
|
: await $api.axios.post(target, params, config).catch((e) => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
if (e.name !== "CanceledError") {
|
|
253
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
254
|
+
message: e.response?.data?.message || "error",
|
|
255
|
+
color: "error",
|
|
256
|
+
})
|
|
257
|
+
throw e
|
|
258
|
+
}
|
|
259
|
+
log.api("axios/post/error", e)
|
|
260
|
+
return {}
|
|
253
261
|
})
|
|
254
262
|
|
|
255
263
|
return {
|
|
@@ -258,7 +266,7 @@ const handleRemoteRequest = async (
|
|
|
258
266
|
}
|
|
259
267
|
} catch (e) {
|
|
260
268
|
if (e.name === "AbortError" || e.name === "CanceledError") {
|
|
261
|
-
log.api(`${method} request was
|
|
269
|
+
log.api(`${method} request was canceled for actionId:`, actionIdentifier)
|
|
262
270
|
throw e
|
|
263
271
|
}
|
|
264
272
|
|
|
@@ -442,7 +450,7 @@ const executeRoute = async (actionIdentifier, validTarget, params, options) => {
|
|
|
442
450
|
|
|
443
451
|
if (error.name === "AbortError" || error.name === "CanceledError") {
|
|
444
452
|
log.api(
|
|
445
|
-
"HTTP request was
|
|
453
|
+
"HTTP request was canceled for actionId:",
|
|
446
454
|
actionIdentifier.actionId,
|
|
447
455
|
)
|
|
448
456
|
throw error
|
|
@@ -162,7 +162,7 @@ const handler = {
|
|
|
162
162
|
requestId,
|
|
163
163
|
data,
|
|
164
164
|
})
|
|
165
|
-
const deleted = data.
|
|
165
|
+
const deleted = data.items || []
|
|
166
166
|
$store.dispatch({ type: "data/hardDelete", payload: deleted })
|
|
167
167
|
if (notify) {
|
|
168
168
|
userNotifier.dataDelete(isOwnRequest, isSystemAction, deleted)
|
|
@@ -129,7 +129,7 @@ const userConfigUpdate = (isAnswerToOwnRequest, isSystemAction, items) =>
|
|
|
129
129
|
color: "info",
|
|
130
130
|
})
|
|
131
131
|
|
|
132
|
-
const dataDelete = (isAnswerToOwnRequest, isSystemAction, deletedItems) =>
|
|
132
|
+
const dataDelete = (isAnswerToOwnRequest, isSystemAction, deletedItems) => {
|
|
133
133
|
deletedItems.forEach((item) => {
|
|
134
134
|
if (isAnswerToOwnRequest) {
|
|
135
135
|
$eventbus.emit("ui/addToSnackbar", {
|
|
@@ -153,6 +153,7 @@ const dataDelete = (isAnswerToOwnRequest, isSystemAction, deletedItems) =>
|
|
|
153
153
|
})
|
|
154
154
|
}
|
|
155
155
|
})
|
|
156
|
+
}
|
|
156
157
|
|
|
157
158
|
const dataMove = (isAnswerToOwnRequest, isSystemAction, items) => {
|
|
158
159
|
items.forEach((item) => {
|
package/yarn.lock
CHANGED
|
@@ -295,10 +295,10 @@
|
|
|
295
295
|
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.9.tgz#d229a7b7f9dac167a156992ef23c7f023653f53b"
|
|
296
296
|
integrity sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==
|
|
297
297
|
|
|
298
|
-
"@raclettejs/types@^0.1.
|
|
299
|
-
version "0.1.
|
|
300
|
-
resolved "https://registry.yarnpkg.com/@raclettejs/types/-/types-0.1.
|
|
301
|
-
integrity sha512-
|
|
298
|
+
"@raclettejs/types@^0.1.17":
|
|
299
|
+
version "0.1.17"
|
|
300
|
+
resolved "https://registry.yarnpkg.com/@raclettejs/types/-/types-0.1.17.tgz#ced377e5fa8879a5790b1c0c838f621917032690"
|
|
301
|
+
integrity sha512-WBhi6Nf/XJPlisF1stEB0KGo5TWw+EMaTuYt39fJKc+Vtyf/SFmZqP2D3BKlssE5N/8bo2DFgf2qUeKowo0onA==
|
|
302
302
|
dependencies:
|
|
303
303
|
"@types/node" "24.5.2"
|
|
304
304
|
fastify "5.6.0"
|