@purpleschool/gptbot 0.14.17 → 0.14.18

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.
@@ -3,6 +3,7 @@ export const UPDATE_POST_ADMIN_CONTROLLER = 'update-post/admin' as const;
3
3
 
4
4
  export const UPDATE_POST_ROUTES = {
5
5
  CREATE: 'create',
6
+ DELETE: 'delete',
6
7
  UPDATE: (uuid: string) => `${uuid}`,
7
8
  FIND_BY_UUID: (uuid: string) => `by/uuid/${uuid}`,
8
9
  FIND_BY_SLUG: (slug: string) => `by/slug/${slug}`,
package/api/routes.ts CHANGED
@@ -487,6 +487,7 @@ export const REST_API = {
487
487
  CREATE: `${ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.CREATE}`,
488
488
  PATCH: (uuid: string) =>
489
489
  `${ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.UPDATE(uuid)}`,
490
+ DELETE: `${ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.DELETE}`,
490
491
  GET_BY_UUID: (uuid: string) =>
491
492
  `${ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.FIND_BY_UUID(uuid)}`,
492
493
  GET_BY_SLUG: (slug: string) =>
@@ -5,6 +5,7 @@ exports.UPDATE_POST_CONTROLLER = 'update-post';
5
5
  exports.UPDATE_POST_ADMIN_CONTROLLER = 'update-post/admin';
6
6
  exports.UPDATE_POST_ROUTES = {
7
7
  CREATE: 'create',
8
+ DELETE: 'delete',
8
9
  UPDATE: (uuid) => `${uuid}`,
9
10
  FIND_BY_UUID: (uuid) => `by/uuid/${uuid}`,
10
11
  FIND_BY_SLUG: (slug) => `by/slug/${slug}`,
@@ -387,6 +387,7 @@ exports.REST_API = {
387
387
  UPDATE_POSTS: {
388
388
  CREATE: `${exports.ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.CREATE}`,
389
389
  PATCH: (uuid) => `${exports.ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.UPDATE(uuid)}`,
390
+ DELETE: `${exports.ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.DELETE}`,
390
391
  GET_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.FIND_BY_UUID(uuid)}`,
391
392
  GET_BY_SLUG: (slug) => `${exports.ROOT}/${CONTROLLERS.UPDATE_POST_ADMIN_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.FIND_BY_SLUG(slug)}`,
392
393
  GET_ALL: `${exports.ROOT}/${CONTROLLERS.UPDATE_POST_CONTROLLER}/${CONTROLLERS.UPDATE_POST_ROUTES.FIND_ALL}`,
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteUpdatePostCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var DeleteUpdatePostCommand;
7
+ (function (DeleteUpdatePostCommand) {
8
+ DeleteUpdatePostCommand.RequestSchema = models_1.UpdatePostSchema.pick({
9
+ uuid: true,
10
+ slug: true,
11
+ })
12
+ .partial()
13
+ .strict()
14
+ .superRefine((value, context) => {
15
+ if (Boolean(value.uuid) === Boolean(value.slug)) {
16
+ context.addIssue({
17
+ code: zod_1.z.ZodIssueCode.custom,
18
+ message: 'Pass either uuid or slug',
19
+ });
20
+ }
21
+ });
22
+ DeleteUpdatePostCommand.ResponseSchema = zod_1.z.object({
23
+ isDeleted: zod_1.z.boolean(),
24
+ });
25
+ })(DeleteUpdatePostCommand || (exports.DeleteUpdatePostCommand = DeleteUpdatePostCommand = {}));
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-update-post.command"), exports);
18
18
  __exportStar(require("./create-update-post-translation.command"), exports);
19
+ __exportStar(require("./delete-update-post.command"), exports);
19
20
  __exportStar(require("./find-all-update-posts.command"), exports);
20
21
  __exportStar(require("./find-update-post.command"), exports);
21
22
  __exportStar(require("./get-all-update-post-translations.query"), exports);
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { UpdatePostSchema } from '../../models';
3
+
4
+ export namespace DeleteUpdatePostCommand {
5
+ export const RequestSchema = UpdatePostSchema.pick({
6
+ uuid: true,
7
+ slug: true,
8
+ })
9
+ .partial()
10
+ .strict()
11
+ .superRefine((value, context) => {
12
+ if (Boolean(value.uuid) === Boolean(value.slug)) {
13
+ context.addIssue({
14
+ code: z.ZodIssueCode.custom,
15
+ message: 'Pass either uuid or slug',
16
+ });
17
+ }
18
+ });
19
+
20
+ export type Request = { uuid: string } | { slug: string };
21
+
22
+ export const ResponseSchema = z.object({
23
+ isDeleted: z.boolean(),
24
+ });
25
+ export type Response = z.infer<typeof ResponseSchema>;
26
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './create-update-post.command';
2
2
  export * from './create-update-post-translation.command';
3
+ export * from './delete-update-post.command';
3
4
  export * from './find-all-update-posts.command';
4
5
  export * from './find-update-post.command';
5
6
  export * from './get-all-update-post-translations.query';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.14.17",
3
+ "version": "0.14.18",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",