@purpleschool/gptbot-tools 0.2.50 → 0.2.51

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.
Files changed (75) hide show
  1. package/ai-proxy/routes/ai-proxy.routes.ts +1 -0
  2. package/build/ai-proxy/routes/ai-proxy.routes.js +1 -0
  3. package/build/index.js +3 -0
  4. package/build/photo-sessions/commands/admin/create-photo-session-style.command.js +21 -0
  5. package/build/photo-sessions/commands/admin/delete-photo-session-style.command.js +12 -0
  6. package/build/photo-sessions/commands/admin/index.js +19 -0
  7. package/build/photo-sessions/commands/admin/update-photo-session-style.command.js +28 -0
  8. package/build/photo-sessions/commands/delete-all-photo-sessions-jobs.command.js +15 -0
  9. package/build/photo-sessions/commands/delete-photo-sessions-job-by-uuid.command.js +14 -0
  10. package/build/photo-sessions/commands/get-photo-sessions-price.command.js +30 -0
  11. package/build/photo-sessions/commands/index.js +26 -0
  12. package/build/photo-sessions/commands/photo-sessions.command.js +41 -0
  13. package/build/photo-sessions/commands/retry-photo-sessions-job.command.js +23 -0
  14. package/build/photo-sessions/commands/set-reaction-to-photo-sessions-job.command.js +27 -0
  15. package/build/photo-sessions/commands/update-photo-sessions-job-favorite.command.js +16 -0
  16. package/build/photo-sessions/commands/update-photo-sessions-job-title.command.js +16 -0
  17. package/build/photo-sessions/commands/update-published-status-photo-sessions-jobs.command.js +26 -0
  18. package/build/photo-sessions/enums/index.js +18 -0
  19. package/build/photo-sessions/enums/photo-session-look-type.enum.js +9 -0
  20. package/build/photo-sessions/enums/photo-session-strategy.enum.js +8 -0
  21. package/build/photo-sessions/index.js +21 -0
  22. package/build/photo-sessions/models/index.js +20 -0
  23. package/build/photo-sessions/models/photo-session-config.schema.js +16 -0
  24. package/build/photo-sessions/models/photo-session-job.schema.js +46 -0
  25. package/build/photo-sessions/models/photo-session-model.schema.js +42 -0
  26. package/build/photo-sessions/models/photo-session-style.schema.js +22 -0
  27. package/build/photo-sessions/queries/find-photo-session-style-by-id.query.js +10 -0
  28. package/build/photo-sessions/queries/find-photo-session-styles.query.js +19 -0
  29. package/build/photo-sessions/queries/find-photo-sessions-job-by-id.query.js +10 -0
  30. package/build/photo-sessions/queries/find-photo-sessions-jobs.query.js +28 -0
  31. package/build/photo-sessions/queries/get-photo-sessions-config.query.js +10 -0
  32. package/build/photo-sessions/queries/index.js +21 -0
  33. package/build/photo-sessions/routes/index.js +18 -0
  34. package/build/photo-sessions/routes/photo-sessions.amqp.routes.js +22 -0
  35. package/build/photo-sessions/routes/photo-sessions.http.routes.js +4 -0
  36. package/build/tools/enums/tool-content-type.enum.js +1 -0
  37. package/build/tools/enums/tool-type.enum.js +1 -0
  38. package/build/tools/models/global-tools-config.schema.js +2 -0
  39. package/index.ts +3 -0
  40. package/package.json +1 -1
  41. package/photo-sessions/commands/admin/create-photo-session-style.command.ts +22 -0
  42. package/photo-sessions/commands/admin/delete-photo-session-style.command.ts +12 -0
  43. package/photo-sessions/commands/admin/index.ts +3 -0
  44. package/photo-sessions/commands/admin/update-photo-session-style.command.ts +34 -0
  45. package/photo-sessions/commands/delete-all-photo-sessions-jobs.command.ts +15 -0
  46. package/photo-sessions/commands/delete-photo-sessions-job-by-uuid.command.ts +14 -0
  47. package/photo-sessions/commands/get-photo-sessions-price.command.ts +32 -0
  48. package/photo-sessions/commands/index.ts +10 -0
  49. package/photo-sessions/commands/photo-sessions.command.ts +41 -0
  50. package/photo-sessions/commands/retry-photo-sessions-job.command.ts +23 -0
  51. package/photo-sessions/commands/set-reaction-to-photo-sessions-job.command.ts +30 -0
  52. package/photo-sessions/commands/update-photo-sessions-job-favorite.command.ts +16 -0
  53. package/photo-sessions/commands/update-photo-sessions-job-title.command.ts +16 -0
  54. package/photo-sessions/commands/update-published-status-photo-sessions-jobs.command.ts +26 -0
  55. package/photo-sessions/enums/index.ts +2 -0
  56. package/photo-sessions/enums/photo-session-look-type.enum.ts +5 -0
  57. package/photo-sessions/enums/photo-session-strategy.enum.ts +4 -0
  58. package/photo-sessions/index.ts +5 -0
  59. package/photo-sessions/models/index.ts +4 -0
  60. package/photo-sessions/models/photo-session-config.schema.ts +17 -0
  61. package/photo-sessions/models/photo-session-job.schema.ts +49 -0
  62. package/photo-sessions/models/photo-session-model.schema.ts +56 -0
  63. package/photo-sessions/models/photo-session-style.schema.ts +25 -0
  64. package/photo-sessions/queries/find-photo-session-style-by-id.query.ts +11 -0
  65. package/photo-sessions/queries/find-photo-session-styles.query.ts +21 -0
  66. package/photo-sessions/queries/find-photo-sessions-job-by-id.query.ts +11 -0
  67. package/photo-sessions/queries/find-photo-sessions-jobs.query.ts +30 -0
  68. package/photo-sessions/queries/get-photo-sessions-config.query.ts +11 -0
  69. package/photo-sessions/queries/index.ts +5 -0
  70. package/photo-sessions/routes/index.ts +2 -0
  71. package/photo-sessions/routes/photo-sessions.amqp.routes.ts +19 -0
  72. package/photo-sessions/routes/photo-sessions.http.routes.ts +1 -0
  73. package/tools/enums/tool-content-type.enum.ts +1 -0
  74. package/tools/enums/tool-type.enum.ts +1 -0
  75. package/tools/models/global-tools-config.schema.ts +2 -0
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindPhotoSessionsJobsQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
7
+ const models_1 = require("../models");
8
+ const tools_1 = require("../../tools");
9
+ var FindPhotoSessionsJobsQuery;
10
+ (function (FindPhotoSessionsJobsQuery) {
11
+ FindPhotoSessionsJobsQuery.RequestSchema = zod_1.z.object({
12
+ userId: zod_1.z.string().uuid().optional(),
13
+ unregisteredUserId: zod_1.z.string().uuid().optional(),
14
+ scope: zod_1.z.nativeEnum(common_1.JOB_SCOPE).optional().default(common_1.JOB_SCOPE.TOOL),
15
+ title: zod_1.z.string().optional(),
16
+ isFavorite: zod_1.z.coerce.boolean().optional(),
17
+ createdAtSortOrder: zod_1.z.nativeEnum(tools_1.JOB_SORT).optional().default(tools_1.JOB_SORT.DESC),
18
+ status: zod_1.z.nativeEnum(tools_1.JOB_STATUS).optional(),
19
+ limit: zod_1.z.coerce.number().min(1).optional(),
20
+ offset: zod_1.z.coerce.number().min(0).default(0).optional(),
21
+ });
22
+ FindPhotoSessionsJobsQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.object({
23
+ data: zod_1.z.array(models_1.PhotoSessionJobSchema),
24
+ page: zod_1.z.number(),
25
+ totalPages: zod_1.z.number(),
26
+ total: zod_1.z.number(),
27
+ }));
28
+ })(FindPhotoSessionsJobsQuery || (exports.FindPhotoSessionsJobsQuery = FindPhotoSessionsJobsQuery = {}));
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetPhotoSessionsConfigQuery = void 0;
4
+ const common_1 = require("../../common");
5
+ const models_1 = require("../models");
6
+ var GetPhotoSessionsConfigQuery;
7
+ (function (GetPhotoSessionsConfigQuery) {
8
+ GetPhotoSessionsConfigQuery.RequestSchema = common_1.LocaleRequestSchema;
9
+ GetPhotoSessionsConfigQuery.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.PhotoSessionConfigSchema);
10
+ })(GetPhotoSessionsConfigQuery || (exports.GetPhotoSessionsConfigQuery = GetPhotoSessionsConfigQuery = {}));
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./find-photo-sessions-job-by-id.query"), exports);
18
+ __exportStar(require("./find-photo-sessions-jobs.query"), exports);
19
+ __exportStar(require("./get-photo-sessions-config.query"), exports);
20
+ __exportStar(require("./find-photo-session-styles.query"), exports);
21
+ __exportStar(require("./find-photo-session-style-by-id.query"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./photo-sessions.amqp.routes"), exports);
18
+ __exportStar(require("./photo-sessions.http.routes"), exports);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PHOTO_SESSIONS_AMQP_ROUTES = void 0;
4
+ exports.PHOTO_SESSIONS_AMQP_ROUTES = {
5
+ EXECUTE: 'tools.photo-sessions.execute.rpc',
6
+ GET_PRICE: 'tools.photo-sessions.get-price.rpc',
7
+ CONFIG: 'tools.photo-sessions.config.rpc',
8
+ GET_JOB: 'tools.photo-sessions.jobs.get.rpc',
9
+ LIST_JOBS: 'tools.photo-sessions.jobs.list.rpc',
10
+ SET_REACTION: 'tools.photo-sessions.jobs.set-reaction.rpc',
11
+ UPDATE_TITLE: 'tools.photo-sessions.jobs.update-title.rpc',
12
+ UPDATE_FAVORITE: 'tools.photo-sessions.jobs.update-favorite.rpc',
13
+ SOFT_DELETE: 'tools.photo-sessions.jobs.soft-delete.rpc',
14
+ SOFT_DELETE_ALL: 'tools.photo-sessions.jobs.soft-delete-all.rpc',
15
+ RETRY: 'tools.photo-sessions.jobs.retry.rpc',
16
+ UPDATE_JOB: 'tools.photo-sessions.jobs.update.rpc',
17
+ LIST_STYLES: 'tools.photo-sessions.styles.list.rpc',
18
+ GET_STYLE: 'tools.photo-sessions.styles.get.rpc',
19
+ CREATE_STYLE: 'tools.photo-sessions.styles.create.rpc',
20
+ UPDATE_STYLE: 'tools.photo-sessions.styles.update.rpc',
21
+ DELETE_STYLE: 'tools.photo-sessions.styles.delete.rpc',
22
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PHOTO_SESSIONS_CONTROLLER = void 0;
4
+ exports.PHOTO_SESSIONS_CONTROLLER = 'photo-sessions';
@@ -20,5 +20,6 @@ var TOOL_CONTENT_TYPE;
20
20
  TOOL_CONTENT_TYPE["SPELL_CORRECTOR"] = "SPELL_CORRECTOR";
21
21
  TOOL_CONTENT_TYPE["DIAGRAMS"] = "DIAGRAMS";
22
22
  TOOL_CONTENT_TYPE["HTML_PAGE_BUILDER"] = "HTML_PAGE_BUILDER";
23
+ TOOL_CONTENT_TYPE["PHOTO_SESSIONS"] = "PHOTO_SESSIONS";
23
24
  TOOL_CONTENT_TYPE["IMAGE_RECOGNITION"] = "IMAGE_RECOGNITION";
24
25
  })(TOOL_CONTENT_TYPE || (exports.TOOL_CONTENT_TYPE = TOOL_CONTENT_TYPE = {}));
@@ -22,5 +22,6 @@ var TOOL_TYPE;
22
22
  TOOL_TYPE["SOLVING_EDU_TASK"] = "SOLVING_EDU_TASK";
23
23
  TOOL_TYPE["DIAGRAMS"] = "DIAGRAMS";
24
24
  TOOL_TYPE["HTML_PAGE_BUILDER"] = "HTML_PAGE_BUILDER";
25
+ TOOL_TYPE["PHOTO_SESSION"] = "PHOTO_SESSION";
25
26
  TOOL_TYPE["IMAGE_RECOGNITION"] = "IMAGE_RECOGNITION";
26
27
  })(TOOL_TYPE || (exports.TOOL_TYPE = TOOL_TYPE = {}));
@@ -19,6 +19,7 @@ const solving_edu_task_1 = require("../../solving-edu-task");
19
19
  const spell_corrector_1 = require("../../spell-corrector");
20
20
  const diagrams_1 = require("../../diagrams");
21
21
  const models_2 = require("../../html-page-builder/models");
22
+ const photo_sessions_1 = require("../../photo-sessions");
22
23
  const image_recognition_1 = require("../../image-recognition");
23
24
  exports.GlobalToolsConfigSchema = zod_1.z.object({
24
25
  [enums_1.TOOL_CONTENT_TYPE.VIDEO]: video_1.VideoConfigSchema,
@@ -37,5 +38,6 @@ exports.GlobalToolsConfigSchema = zod_1.z.object({
37
38
  [enums_1.TOOL_CONTENT_TYPE.SPELL_CORRECTOR]: spell_corrector_1.SpellCorrectorToolConfigSchema,
38
39
  [enums_1.TOOL_CONTENT_TYPE.DIAGRAMS]: diagrams_1.DiagramsConfigSchema,
39
40
  [enums_1.TOOL_CONTENT_TYPE.HTML_PAGE_BUILDER]: models_2.HtmlPageBuilderConfigSchema,
41
+ [enums_1.TOOL_CONTENT_TYPE.PHOTO_SESSIONS]: photo_sessions_1.PhotoSessionConfigSchema,
40
42
  [enums_1.TOOL_CONTENT_TYPE.IMAGE_RECOGNITION]: image_recognition_1.ImageRecognitionConfigSchema,
41
43
  });
package/index.ts CHANGED
@@ -22,6 +22,7 @@ export * from './html-page-builder';
22
22
  export * from './tool-workspace';
23
23
  export * from './diagrams';
24
24
  export * from './image-recognition';
25
+ export * from './photo-sessions';
25
26
 
26
27
  import * as common from './common';
27
28
  import * as paraphrase from './paraphrase';
@@ -47,6 +48,7 @@ import * as accountMerge from './account-merge';
47
48
  import * as toolWorkspace from './tool-workspace';
48
49
  import * as diagrams from './diagrams';
49
50
  import * as imageRecognition from './image-recognition';
51
+ import * as photoSessions from './photo-sessions';
50
52
 
51
53
  export namespace ToolService {
52
54
  export import Common = common;
@@ -73,4 +75,5 @@ export namespace ToolService {
73
75
  export import ToolWorkspace = toolWorkspace;
74
76
  export import Diagrams = diagrams;
75
77
  export import ImageRecognition = imageRecognition;
78
+ export import PhotoSessions = photoSessions;
76
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.2.50",
3
+ "version": "0.2.51",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../../common/models/command-response.schema';
3
+ import { PhotoSessionStyleSchema } from '../../models';
4
+
5
+ export const CreatePhotoSessionStyleReferenceSchema = z.object({
6
+ photoUrl: z.string(),
7
+ description: z.string().optional(),
8
+ order: z.number().int().min(0).max(5),
9
+ });
10
+
11
+ export namespace CreatePhotoSessionStyleCommand {
12
+ export const RequestSchema = z.object({
13
+ code: z.string(),
14
+ title: z.string(),
15
+ description: z.string().optional(),
16
+ references: z.array(CreatePhotoSessionStyleReferenceSchema).max(6),
17
+ });
18
+ export type Request = z.infer<typeof RequestSchema>;
19
+
20
+ export const ResponseSchema = ICommandResponseSchema(PhotoSessionStyleSchema);
21
+ export type Response = z.infer<typeof ResponseSchema>;
22
+ }
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../../common/models/command-response.schema';
3
+
4
+ export namespace DeletePhotoSessionStyleCommand {
5
+ export const RequestSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseSchema = ICommandResponseSchema(z.boolean());
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -0,0 +1,3 @@
1
+ export * from './create-photo-session-style.command';
2
+ export * from './update-photo-session-style.command';
3
+ export * from './delete-photo-session-style.command';
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../../common/models/command-response.schema';
3
+ import { PhotoSessionStyleSchema } from '../../models';
4
+ import { CreatePhotoSessionStyleReferenceSchema } from './create-photo-session-style.command';
5
+
6
+ const UpdatePhotoSessionStyleReferenceSchema = CreatePhotoSessionStyleReferenceSchema.extend({
7
+ uuid: z.string().uuid().optional(),
8
+ }).refine(
9
+ (ref) => {
10
+ if (
11
+ ref.photoUrl === undefined &&
12
+ ref.description === undefined &&
13
+ ref.order === undefined
14
+ ) {
15
+ return false;
16
+ }
17
+ return true;
18
+ },
19
+ { message: 'At least one field must be provided for reference update' },
20
+ );
21
+
22
+ export namespace UpdatePhotoSessionStyleCommand {
23
+ export const RequestSchema = z.object({
24
+ uuid: z.string().uuid(),
25
+ code: z.string().optional(),
26
+ title: z.string().optional(),
27
+ description: z.string().nullable().optional(),
28
+ references: z.array(UpdatePhotoSessionStyleReferenceSchema).max(6).optional(),
29
+ });
30
+ export type Request = z.infer<typeof RequestSchema>;
31
+
32
+ export const ResponseSchema = ICommandResponseSchema(PhotoSessionStyleSchema);
33
+ export type Response = z.infer<typeof ResponseSchema>;
34
+ }
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { JOB_SCOPE } from '../../common';
3
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
4
+
5
+ export namespace DeleteAllPhotoSessionsJobsCommand {
6
+ export const RequestSchema = z.object({
7
+ userId: z.string().uuid().nullable().optional(),
8
+ unregisteredUserId: z.string().uuid().nullable().optional(),
9
+ scope: z.nativeEnum(JOB_SCOPE).optional().default(JOB_SCOPE.TOOL),
10
+ });
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = ICommandResponseSchema(z.boolean());
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+
4
+ export namespace DeletePhotoSessionsJobByUuidCommand {
5
+ export const RequestSchema = z.object({
6
+ userId: z.string().uuid().nullable().optional(),
7
+ unregisteredUserId: z.string().uuid().nullable().optional(),
8
+ uuid: z.string(),
9
+ });
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = ICommandResponseSchema(z.boolean());
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { AttachedFileSchema } from '../../common';
4
+
5
+ export namespace GetPhotoSessionsPriceCommand {
6
+ export const RequestSchema = z.object({
7
+ modelId: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ prompt: z.string().optional().default(''),
11
+ params: z.object({
12
+ attachedFiles: z.array(AttachedFileSchema).min(1).max(3),
13
+ styleId: z.string().uuid().nullable().optional(),
14
+ referenceIds: z.array(z.string().uuid()).optional().default([]),
15
+ customStylePrompt: z.string().nullable().optional(),
16
+ customStylePhotos: z.array(z.string()).optional().default([]),
17
+ clothingPhotos: z.array(z.string()).optional().default([]),
18
+ hairstylePhotos: z.array(z.string()).optional().default([]),
19
+ accessoriesPhotos: z.array(z.string()).optional().default([]),
20
+ }),
21
+ userHasActiveSubscriptionOrProduct: z.boolean(),
22
+ });
23
+ export type Request = z.infer<typeof RequestSchema>;
24
+
25
+ export const ResponseDataSchema = z.object({
26
+ price: z.number(),
27
+ });
28
+ export type ResponseData = z.infer<typeof ResponseDataSchema>;
29
+
30
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
31
+ export type Response = z.infer<typeof ResponseSchema>;
32
+ }
@@ -0,0 +1,10 @@
1
+ export * from './delete-photo-sessions-job-by-uuid.command';
2
+ export * from './delete-all-photo-sessions-jobs.command';
3
+ export * from './get-photo-sessions-price.command';
4
+ export * from './retry-photo-sessions-job.command';
5
+ export * from './set-reaction-to-photo-sessions-job.command';
6
+ export * from './photo-sessions.command';
7
+ export * from './update-photo-sessions-job-title.command';
8
+ export * from './update-photo-sessions-job-favorite.command';
9
+ export * from './update-published-status-photo-sessions-jobs.command';
10
+ export * from './admin';
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { AttachedFileSchema, JOB_SCOPE } from '../../common';
3
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
4
+ import { LocaleSchema } from '../../common/models/locale.schema';
5
+ import { PhotoSessionJobSchema } from '../models';
6
+ import { TOOL_WORKSPACE_ITEM_SLOT } from '../../tool-workspace';
7
+ import { TOOL_CONTENT_TYPE } from '../../tools';
8
+
9
+ export namespace PhotoSessionsCommand {
10
+ export const RequestSchema = z.object({
11
+ locale: LocaleSchema,
12
+ userId: z.string().uuid().nullable().optional(),
13
+ unregisteredUserId: z.string().uuid().nullable().optional(),
14
+ scope: z.nativeEnum(JOB_SCOPE).optional().default(JOB_SCOPE.TOOL),
15
+ workspaceId: z.string().uuid().nullable().optional(),
16
+ workspaceItemId: z.string().uuid().nullable().optional(),
17
+ workspaceToolType: z.nativeEnum(TOOL_CONTENT_TYPE).nullable().optional(),
18
+ workspaceSlot: z.nativeEnum(TOOL_WORKSPACE_ITEM_SLOT).optional(),
19
+ workspaceOrder: z.number().int().min(0).optional(),
20
+ prompt: z.string().optional().default(''),
21
+ modelId: z.string(),
22
+ params: z.object({
23
+ attachedFiles: z.array(AttachedFileSchema).min(1).max(3),
24
+ styleId: z.string().uuid().nullable().optional(),
25
+ referenceIds: z.array(z.string().uuid()).optional().default([]),
26
+ customStylePrompt: z.string().nullable().optional(),
27
+ customStylePhotos: z.array(z.string()).optional().default([]),
28
+ clothingPhotos: z.array(z.string()).max(6).optional().default([]),
29
+ hairstylePhotos: z.array(z.string()).max(6).optional().default([]),
30
+ accessoriesPhotos: z.array(z.string()).max(6).optional().default([]),
31
+ aspectRatio: z.string().optional(),
32
+ }),
33
+ userHasActiveSubscriptionOrProduct: z.boolean(),
34
+ tokenReservationId: z.string().uuid(),
35
+ precalculatedPrice: z.number(),
36
+ });
37
+ export type Request = z.infer<typeof RequestSchema>;
38
+
39
+ export const ResponseSchema = ICommandResponseSchema(z.array(PhotoSessionJobSchema));
40
+ export type Response = z.infer<typeof ResponseSchema>;
41
+ }
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { PhotoSessionJobParamsSchema, PhotoSessionJobSchema } from '../models';
4
+ import { LocaleSchema } from '../../common';
5
+
6
+ export namespace RetryPhotoSessionsJobCommand {
7
+ export const RequestSchema = z.object({
8
+ locale: LocaleSchema,
9
+ uuid: z.string().uuid(),
10
+ userId: z.string().uuid().nullable().optional(),
11
+ unregisteredUserId: z.string().uuid().nullable().optional(),
12
+ userHasActiveSubscriptionOrProduct: z.boolean(),
13
+ tokenReservationId: z.string().uuid(),
14
+ precalculatedPrice: z.number(),
15
+ modelId: z.string().optional(),
16
+ prompt: z.string().optional(),
17
+ params: PhotoSessionJobParamsSchema.optional(),
18
+ });
19
+ export type Request = z.infer<typeof RequestSchema>;
20
+
21
+ export const ResponseSchema = ICommandResponseSchema(PhotoSessionJobSchema);
22
+ export type Response = z.infer<typeof ResponseSchema>;
23
+ }
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { PhotoSessionJobSchema } from '../models';
4
+ import { USER_REACTION } from '../../common';
5
+
6
+ export namespace SetReactionToPhotoSessionsJobCommand {
7
+ export const RequestSchema = z
8
+ .object({
9
+ userId: z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: z.string().uuid().nullable().optional(),
11
+ uuid: z.string().uuid(),
12
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
13
+ dislikeReason: z.string().nullable().default(null),
14
+ })
15
+ .refine(
16
+ (data) => {
17
+ if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
18
+ return false;
19
+ }
20
+ return true;
21
+ },
22
+ {
23
+ message: 'Dislike reason is not allowed when reaction is not disliked',
24
+ },
25
+ );
26
+ export type Request = z.infer<typeof RequestSchema>;
27
+
28
+ export const ResponseSchema = ICommandResponseSchema(PhotoSessionJobSchema);
29
+ export type Response = z.infer<typeof ResponseSchema>;
30
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { PhotoSessionJobSchema } from '../models';
4
+
5
+ export namespace UpdatePhotoSessionsJobFavoriteCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ isFavorite: z.boolean(),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = ICommandResponseSchema(PhotoSessionJobSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { PhotoSessionJobSchema } from '../models';
4
+
5
+ export namespace UpdatePhotoSessionsJobTitleCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ title: z.string().min(1).max(40),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = ICommandResponseSchema(PhotoSessionJobSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { PhotoSessionJobSchema } from '../models';
4
+
5
+ export namespace UpdatePublishedStatusPhotoSessionsJobsCommand {
6
+ export const RequestSchema = z.object({
7
+ criteria: z.object({
8
+ uuid: z.string().uuid(),
9
+ userId: z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: z.string().uuid().nullable().optional(),
11
+ }),
12
+ data: z
13
+ .object({
14
+ isPublished: z.boolean(),
15
+ postId: z.string().nullable().optional(),
16
+ })
17
+ .refine((data) => (data.isPublished ? !!data.postId : true), {
18
+ message: 'Post ID is required when job is published',
19
+ path: ['postId'],
20
+ }),
21
+ });
22
+ export type Request = z.infer<typeof RequestSchema>;
23
+
24
+ export const ResponseSchema = ICommandResponseSchema(PhotoSessionJobSchema);
25
+ export type Response = z.infer<typeof ResponseSchema>;
26
+ }
@@ -0,0 +1,2 @@
1
+ export * from './photo-session-strategy.enum';
2
+ export * from './photo-session-look-type.enum';
@@ -0,0 +1,5 @@
1
+ export enum PHOTO_SESSION_LOOK_TYPE {
2
+ CLOTHING = 'clothing',
3
+ HAIRSTYLE = 'hairstyle',
4
+ ACCESSORIES = 'accessories',
5
+ }
@@ -0,0 +1,4 @@
1
+ export enum PHOTO_SESSION_STRATEGY {
2
+ NANO_BANANA_PRO_CALLBACK = 'NANO_BANANA_PRO_CALLBACK',
3
+ OPENAI_IMAGE_1_GENERATION = 'OPENAI_IMAGE_1_GENERATION',
4
+ }
@@ -0,0 +1,5 @@
1
+ export * from './commands';
2
+ export * from './enums';
3
+ export * from './models';
4
+ export * from './queries';
5
+ export * from './routes';
@@ -0,0 +1,4 @@
1
+ export * from './photo-session-config.schema';
2
+ export * from './photo-session-job.schema';
3
+ export * from './photo-session-model.schema';
4
+ export * from './photo-session-style.schema';
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { PhotoSessionModelSchema } from './photo-session-model.schema';
3
+ import { PhotoSessionStyleSchema } from './photo-session-style.schema';
4
+ import { PHOTO_SESSION_LOOK_TYPE } from '../enums';
5
+
6
+ export const PhotoSessionLookCategorySchema = z.object({
7
+ type: z.nativeEnum(PHOTO_SESSION_LOOK_TYPE),
8
+ maxPhotos: z.number(),
9
+ });
10
+
11
+ export const PhotoSessionConfigSchema = z.object({
12
+ models: z.array(PhotoSessionModelSchema),
13
+ styles: z.array(PhotoSessionStyleSchema),
14
+ looks: z.array(PhotoSessionLookCategorySchema),
15
+ });
16
+
17
+ export type PhotoSessionConfig = z.infer<typeof PhotoSessionConfigSchema>;
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import { JOB_STATUS } from '../../tools';
3
+ import { AttachedFileSchema, USER_REACTION } from '../../common';
4
+
5
+ export const PhotoSessionJobParamsSchema = z.object({
6
+ attachedFiles: z.array(AttachedFileSchema).optional(),
7
+ imageUrls: z.array(z.string()).optional(),
8
+ styleId: z.string().uuid().nullable().optional(),
9
+ referenceId: z.string().uuid().nullable().optional(),
10
+ referenceIds: z.array(z.string().uuid()).optional(),
11
+ customStylePrompt: z.string().nullable().optional(),
12
+ customStylePhotos: z.array(z.string()).optional(),
13
+ clothingPhotos: z.array(z.string()).optional(),
14
+ hairstylePhotos: z.array(z.string()).optional(),
15
+ accessoriesPhotos: z.array(z.string()).optional(),
16
+ aspectRatio: z.string().optional(),
17
+ userHasActiveSubscriptionOrProduct: z.boolean().optional(),
18
+ });
19
+
20
+ export type PhotoSessionJobParams = z.infer<typeof PhotoSessionJobParamsSchema>;
21
+
22
+ export const PhotoSessionJobSchema = z.object({
23
+ uuid: z.string(),
24
+ prompt: z.string(),
25
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
26
+ dislikeReason: z.string().nullable(),
27
+ externalId: z.string().nullable(),
28
+ title: z.string(),
29
+ status: z.nativeEnum(JOB_STATUS),
30
+ error: z.string().nullable(),
31
+ modelId: z.string(),
32
+ price: z.number(),
33
+ previewUrl: z.string().nullable(),
34
+ params: PhotoSessionJobParamsSchema,
35
+ imageUrls: z.array(z.string()).nullable(),
36
+ attempts: z.array(z.any()),
37
+ userId: z.string().nullable().optional(),
38
+ unregisteredUserId: z.string().nullable().optional(),
39
+ isPublished: z.boolean(),
40
+ postId: z.string().nullable(),
41
+ isDeleted: z.boolean(),
42
+ isFavorite: z.boolean(),
43
+ tokenReservationId: z.string().nullable().optional(),
44
+ createdAt: z.date(),
45
+ completedAt: z.date().nullable().optional(),
46
+ updatedAt: z.date(),
47
+ });
48
+
49
+ export type PhotoSessionJob = z.infer<typeof PhotoSessionJobSchema>;
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { TOOL_MODEL_STATUS, IconVariantsSchema } from '../../common';
3
+ import { PHOTO_SESSION_STRATEGY } from '../enums';
4
+
5
+ export const PhotoSessionModelParamsSchema = z.object({
6
+ imageAttachment: z.object({
7
+ supported: z.boolean(),
8
+ maxImages: z.number(),
9
+ acceptedTypes: z.array(z.string()),
10
+ }),
11
+ aspectRatio: z.record(
12
+ z.string(),
13
+ z.object({
14
+ width: z.number(),
15
+ height: z.number(),
16
+ }),
17
+ ),
18
+ });
19
+
20
+ export type PhotoSessionModelParams = z.infer<typeof PhotoSessionModelParamsSchema>;
21
+
22
+ export const PhotoSessionModelPricingRuleConditionSchema = z.object({
23
+ withoutSub: z.boolean().optional(),
24
+ });
25
+ export type PhotoSessionModelPricingRuleCondition = z.infer<
26
+ typeof PhotoSessionModelPricingRuleConditionSchema
27
+ >;
28
+
29
+ export const PhotoSessionModelPricingRulesSchema = z.array(
30
+ z.object({
31
+ condition: PhotoSessionModelPricingRuleConditionSchema,
32
+ value: z.number(),
33
+ }),
34
+ );
35
+ export type PhotoSessionModelPricingRules = z.infer<typeof PhotoSessionModelPricingRulesSchema>;
36
+
37
+ export const PhotoSessionModelSchema = z.object({
38
+ uuid: z.string(),
39
+ title: z.string(),
40
+ description: z.string(),
41
+ aiModel: z.string(),
42
+ isNew: z.boolean(),
43
+ tierLabel: z.string(),
44
+ pricePerImage: z.number(),
45
+ order: z.number(),
46
+ status: z.nativeEnum(TOOL_MODEL_STATUS),
47
+ icons: IconVariantsSchema,
48
+ strategy: z.nativeEnum(PHOTO_SESSION_STRATEGY),
49
+ maxInputLength: z.number(),
50
+ params: PhotoSessionModelParamsSchema,
51
+ pricingRules: PhotoSessionModelPricingRulesSchema,
52
+ createdAt: z.date(),
53
+ updatedAt: z.date(),
54
+ });
55
+
56
+ export type PhotoSessionModel = z.infer<typeof PhotoSessionModelSchema>;