@dgpholdings/greatoak-shared 1.1.43 → 1.1.45

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.
@@ -1,4 +1,4 @@
1
- import { TRecord, TRecordBodyWeight, TRecordDistance, TRecordDuration, TRecordWeight } from "../types/TApiExerciseRecord";
1
+ import { TRecord, TRecordWeight, TRecordDuration, TRecordBodyWeight, TRecordDistance } from "../types";
2
2
  export declare const isRecordWeightTypeGuard: (param: TRecord[]) => param is TRecordWeight[];
3
3
  export declare const isRecordDurationTypeGuard: (param: TRecord[]) => param is TRecordDuration[];
4
4
  export declare const isRecordBodyWeightTypeGuard: (param: TRecord[]) => param is TRecordBodyWeight[];
@@ -1,4 +1,4 @@
1
- import { TRecord } from "./TApiExerciseRecord";
1
+ import { TRecord } from "./commonTypes";
2
2
  export type TBodyPart = "Chest" | "Core" | "Shoulders" | "Back" | "Biceps" | "Triceps" | "Forearms" | "Legs";
3
3
  export declare enum EBodyParts {
4
4
  "pectoralis-major" = "Pectoralis major upper",
@@ -122,7 +122,9 @@ export type TExercise = {
122
122
  };
123
123
  export type TBodyPartExercises = Record<TBodyPart, TExercise[]>;
124
124
  export type TApiCreateOrUpdateExerciseReq = {
125
- exercise: Omit<TExercise, "exerciseId">;
125
+ exercise: Omit<TExercise, "exerciseId"> & {
126
+ slug?: string;
127
+ };
126
128
  updateId?: string;
127
129
  };
128
130
  export type TApiCreateOrUpdateExerciseRes = {
@@ -1,60 +1,8 @@
1
- export type TRecord = {
2
- isDone: boolean;
3
- rpe?: string;
4
- setNote?: string;
5
- workDurationSecs?: number;
6
- restDurationSecs?: number;
7
- isStrictMode: boolean;
8
- } & ({
9
- type: "weight-reps";
10
- kg: string;
11
- reps: string;
12
- rir?: string;
13
- } | {
14
- type: "duration";
15
- durationSecs: string;
16
- auxWeightKg: string;
17
- } | {
18
- type: "reps-only";
19
- reps: string;
20
- auxWeightKg: string;
21
- rir?: string;
22
- } | {
23
- type: "distance";
24
- distanceKm: string;
25
- auxWeightKg: string;
26
- durationSecs: string;
27
- });
28
- export type TRecordDuration = Extract<TRecord, {
29
- type: "duration";
30
- }>;
31
- export type TRecordWeight = Extract<TRecord, {
32
- type: "weight-reps";
33
- }>;
34
- export type TRecordBodyWeight = Extract<TRecord, {
35
- type: "reps-only";
36
- }>;
37
- export type TRecordDistance = Extract<TRecord, {
38
- type: "distance";
39
- }>;
40
- export type TRecordConfig = {
41
- enableAuxWeight?: boolean;
42
- enableRir?: boolean;
43
- enableRpe?: boolean;
44
- enableSetNote?: boolean;
45
- enableExerciseNote?: boolean;
46
- enableTimeIntervalMode?: boolean;
47
- };
1
+ import { TTemplateExercise } from "./commonTypes";
48
2
  export type TApiExerciseRecordUpdateReq = {
49
3
  templateId: string;
50
4
  startTime: Date;
51
- records: {
52
- exerciseId: string;
53
- config: TRecordConfig;
54
- exerciseNote: string;
55
- restTimeSecs?: number;
56
- record: TRecord[];
57
- }[];
5
+ records: TTemplateExercise[];
58
6
  };
59
7
  export type TApiExerciseRecordUpdateRes = {
60
8
  status: 201;
@@ -1,20 +1,17 @@
1
- import { TExercise } from "./TApiExercise";
2
- import { TRecord } from "./TApiExerciseRecord";
1
+ import { TRecord, TTemplateExercise } from "./commonTypes";
3
2
  export type TTemplate = {
4
3
  name: string;
5
4
  templateId: string;
6
- exerciseIds: string[];
7
5
  lastUsed?: Date[];
8
6
  createdAt?: string;
9
7
  colorHex?: string;
8
+ exercises: (Omit<TTemplateExercise, "record"> & {
9
+ initialRecords: TRecord[];
10
+ })[];
10
11
  config: {
11
12
  isEnabledStrictDurationTrackingMode: boolean;
12
13
  };
13
14
  };
14
- export type TTemplateExercise = {
15
- template: TTemplate;
16
- exercise: TExercise[];
17
- };
18
15
  export type TApiTemplateCreateReq = {
19
16
  name: string;
20
17
  programId: string | null;
@@ -0,0 +1,74 @@
1
+ import { TTemplateExercise } from "./commonTypes";
2
+ export type TTemplateShopDb = {
3
+ name: {
4
+ default: string;
5
+ en?: string;
6
+ de?: string;
7
+ ru?: string;
8
+ es?: string;
9
+ fr?: string;
10
+ };
11
+ description: {
12
+ default: string;
13
+ en?: string;
14
+ de?: string;
15
+ ru?: string;
16
+ es?: string;
17
+ fr?: string;
18
+ };
19
+ tags: string[];
20
+ slug: string;
21
+ level: "beginner" | "intermediate" | "advanced" | "beginner-intermediate" | "intermediate-advanced" | "all";
22
+ estimatedDuration: number;
23
+ exercises: TTemplateExercise[];
24
+ createdAt?: Date;
25
+ updatedAt?: Date;
26
+ } & ({
27
+ type: "system";
28
+ thumbnailImageUrl: string;
29
+ isPremium: boolean;
30
+ } | {
31
+ type: "customer-created";
32
+ ownerId: string;
33
+ });
34
+ export type TApiTemplateShopCreateReq = TTemplateShopDb;
35
+ export type TApiTemplateShopCreateRes = {
36
+ status: 400;
37
+ state: "failed";
38
+ message: string;
39
+ } | (TTemplateShopDb & {
40
+ status: 201;
41
+ state: "success";
42
+ });
43
+ export type TApiTemplateShopUpdateReq = {
44
+ _id: string;
45
+ } & TTemplateShopDb;
46
+ export type TApiTemplateShopUpdateRes = {
47
+ status: 400;
48
+ state: "failed";
49
+ message: string;
50
+ } | ({
51
+ status: 200;
52
+ state: "success";
53
+ } & TTemplateShopDb);
54
+ export type TApiTemplateShopGetAllReq = {};
55
+ export type TApiTemplateShopGetAllRes = {
56
+ status: 400;
57
+ state: "failed";
58
+ message: string;
59
+ } | {
60
+ status: 200;
61
+ state: "success";
62
+ templates: TTemplateShopDb[];
63
+ };
64
+ export type TApiTemplateShopAdoptOneReq = {
65
+ _id: string;
66
+ };
67
+ export type TApiTemplateShopAdoptOneRes = {
68
+ status: 400;
69
+ state: "failed";
70
+ message: string;
71
+ } | {
72
+ status: 201;
73
+ state: "success";
74
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,54 @@
1
+ export type TRecord = {
2
+ isDone: boolean;
3
+ rpe?: string;
4
+ setNote?: string;
5
+ workDurationSecs?: number;
6
+ restDurationSecs?: number;
7
+ isStrictMode: boolean;
8
+ } & ({
9
+ type: "weight-reps";
10
+ kg: string;
11
+ reps: string;
12
+ rir?: string;
13
+ } | {
14
+ type: "duration";
15
+ durationSecs: string;
16
+ auxWeightKg: string;
17
+ } | {
18
+ type: "reps-only";
19
+ reps: string;
20
+ auxWeightKg: string;
21
+ rir?: string;
22
+ } | {
23
+ type: "distance";
24
+ distanceKm: string;
25
+ auxWeightKg: string;
26
+ durationSecs: string;
27
+ });
28
+ export type TRecordDuration = Extract<TRecord, {
29
+ type: "duration";
30
+ }>;
31
+ export type TRecordWeight = Extract<TRecord, {
32
+ type: "weight-reps";
33
+ }>;
34
+ export type TRecordBodyWeight = Extract<TRecord, {
35
+ type: "reps-only";
36
+ }>;
37
+ export type TRecordDistance = Extract<TRecord, {
38
+ type: "distance";
39
+ }>;
40
+ export type TTemplateConfig = {
41
+ enableAuxWeight?: boolean;
42
+ enableRir?: boolean;
43
+ enableRpe?: boolean;
44
+ enableSetNote?: boolean;
45
+ enableExerciseNote?: boolean;
46
+ enableTimeIntervalMode?: boolean;
47
+ };
48
+ export type TTemplateExercise = {
49
+ exerciseId: string;
50
+ config: TTemplateConfig;
51
+ exerciseNote: string;
52
+ restTimeSecs?: number;
53
+ record: TRecord[];
54
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,3 +5,5 @@ export type * from "./adminApi/TApiAttachment";
5
5
  export type * from "./TApiTemplateData";
6
6
  export type * from "./TApiBillingPlan";
7
7
  export type * from "./TApiUser";
8
+ export type * from "./TApiTemplateShop";
9
+ export type * from "./commonTypes";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.1.43",
3
+ "version": "1.1.45",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",