@routevn/creator-model 1.2.2 → 1.2.3

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/model.js +28 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routevn/creator-model",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/model.js CHANGED
@@ -1203,6 +1203,7 @@ const validateVideoItems = ({ items, path, errorFactory }) => {
1203
1203
  "thumbnailFileId",
1204
1204
  "fileType",
1205
1205
  "fileSize",
1206
+ "duration",
1206
1207
  "width",
1207
1208
  "height",
1208
1209
  ],
@@ -1271,6 +1272,13 @@ const validateVideoItems = ({ items, path, errorFactory }) => {
1271
1272
  );
1272
1273
  }
1273
1274
 
1275
+ if (item.duration !== undefined && !isFiniteNumber(item.duration)) {
1276
+ return invalidFromErrorFactory(
1277
+ errorFactory,
1278
+ `${itemPath}.duration must be a finite number`,
1279
+ );
1280
+ }
1281
+
1274
1282
  if (item.width !== undefined && !isFiniteNumber(item.width)) {
1275
1283
  return invalidFromErrorFactory(
1276
1284
  errorFactory,
@@ -6530,6 +6538,7 @@ const validateVideoCreateData = ({ data, errorFactory }) => {
6530
6538
  "thumbnailFileId",
6531
6539
  "fileType",
6532
6540
  "fileSize",
6541
+ "duration",
6533
6542
  "width",
6534
6543
  "height",
6535
6544
  ],
@@ -6584,6 +6593,13 @@ const validateVideoCreateData = ({ data, errorFactory }) => {
6584
6593
  );
6585
6594
  }
6586
6595
 
6596
+ if (data.duration !== undefined && !isFiniteNumber(data.duration)) {
6597
+ return invalidFromErrorFactory(
6598
+ errorFactory,
6599
+ "payload.data.duration must be a finite number",
6600
+ );
6601
+ }
6602
+
6587
6603
  if (data.width !== undefined && !isFiniteNumber(data.width)) {
6588
6604
  return invalidFromErrorFactory(
6589
6605
  errorFactory,
@@ -6611,6 +6627,7 @@ const validateVideoUpdateData = ({ data, errorFactory }) => {
6611
6627
  "thumbnailFileId",
6612
6628
  "fileType",
6613
6629
  "fileSize",
6630
+ "duration",
6614
6631
  "width",
6615
6632
  "height",
6616
6633
  ],
@@ -6674,6 +6691,13 @@ const validateVideoUpdateData = ({ data, errorFactory }) => {
6674
6691
  );
6675
6692
  }
6676
6693
 
6694
+ if (data.duration !== undefined && !isFiniteNumber(data.duration)) {
6695
+ return invalidFromErrorFactory(
6696
+ errorFactory,
6697
+ "payload.data.duration must be a finite number",
6698
+ );
6699
+ }
6700
+
6677
6701
  if (data.width !== undefined && !isFiniteNumber(data.width)) {
6678
6702
  return invalidFromErrorFactory(
6679
6703
  errorFactory,
@@ -11865,6 +11889,9 @@ const COMMAND_DEFINITIONS = [
11865
11889
  if (payload.data.fileSize !== undefined) {
11866
11890
  nextVideo.fileSize = payload.data.fileSize;
11867
11891
  }
11892
+ if (payload.data.duration !== undefined) {
11893
+ nextVideo.duration = payload.data.duration;
11894
+ }
11868
11895
  if (payload.data.width !== undefined) {
11869
11896
  nextVideo.width = payload.data.width;
11870
11897
  }
@@ -11933,6 +11960,7 @@ const COMMAND_DEFINITIONS = [
11933
11960
  payload.data.thumbnailFileId !== undefined ||
11934
11961
  payload.data.fileType !== undefined ||
11935
11962
  payload.data.fileSize !== undefined ||
11963
+ payload.data.duration !== undefined ||
11936
11964
  payload.data.width !== undefined ||
11937
11965
  payload.data.height !== undefined)
11938
11966
  ) {