@rytass/cms-base-nestjs-graphql-module 0.0.22 → 0.0.24
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/constants/enum/base-action.enum.d.ts +14 -0
- package/constants/enum/base-action.enum.js +17 -0
- package/constants/enum/base-resource.enum.d.ts +4 -0
- package/constants/enum/base-resource.enum.js +7 -0
- package/index.cjs.js +179 -49
- package/mutations/article.mutations.js +63 -11
- package/mutations/category.mutations.d.ts +3 -1
- package/mutations/category.mutations.js +50 -16
- package/package.json +2 -2
- package/queries/article.queries.js +15 -3
- package/queries/category.queries.d.ts +2 -1
- package/queries/category.queries.js +29 -9
- package/resolvers/article-signature.resolver.js +3 -3
- package/resolvers/backstage-article.resolver.js +15 -15
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum BaseAction {
|
|
2
|
+
LIST = "LIST",
|
|
3
|
+
READ = "READ",
|
|
4
|
+
CREATE = "CREATE",
|
|
5
|
+
UPDATE = "UPDATE",
|
|
6
|
+
DELETE = "DELETE",
|
|
7
|
+
DELETE_VERSION = "DELETE_VERSION",
|
|
8
|
+
SUBMIT = "SUBMIT",
|
|
9
|
+
PUT_BACK = "PUT_BACK",
|
|
10
|
+
APPROVE = "APPROVE",
|
|
11
|
+
REJECT = "REJECT",
|
|
12
|
+
RELEASE = "RELEASE",
|
|
13
|
+
WITHDRAW = "WITHDRAW"
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var BaseAction = /*#__PURE__*/ function(BaseAction) {
|
|
2
|
+
BaseAction["LIST"] = "LIST";
|
|
3
|
+
BaseAction["READ"] = "READ";
|
|
4
|
+
BaseAction["CREATE"] = "CREATE";
|
|
5
|
+
BaseAction["UPDATE"] = "UPDATE";
|
|
6
|
+
BaseAction["DELETE"] = "DELETE";
|
|
7
|
+
BaseAction["DELETE_VERSION"] = "DELETE_VERSION";
|
|
8
|
+
BaseAction["SUBMIT"] = "SUBMIT";
|
|
9
|
+
BaseAction["PUT_BACK"] = "PUT_BACK";
|
|
10
|
+
BaseAction["APPROVE"] = "APPROVE";
|
|
11
|
+
BaseAction["REJECT"] = "REJECT";
|
|
12
|
+
BaseAction["RELEASE"] = "RELEASE";
|
|
13
|
+
BaseAction["WITHDRAW"] = "WITHDRAW";
|
|
14
|
+
return BaseAction;
|
|
15
|
+
}({});
|
|
16
|
+
|
|
17
|
+
export { BaseAction };
|
package/index.cjs.js
CHANGED
|
@@ -246,6 +246,28 @@ UpdateArticleArgs = _ts_decorate$s([
|
|
|
246
246
|
graphql.ArgsType()
|
|
247
247
|
], UpdateArticleArgs);
|
|
248
248
|
|
|
249
|
+
var BaseAction = /*#__PURE__*/ function(BaseAction) {
|
|
250
|
+
BaseAction["LIST"] = "LIST";
|
|
251
|
+
BaseAction["READ"] = "READ";
|
|
252
|
+
BaseAction["CREATE"] = "CREATE";
|
|
253
|
+
BaseAction["UPDATE"] = "UPDATE";
|
|
254
|
+
BaseAction["DELETE"] = "DELETE";
|
|
255
|
+
BaseAction["DELETE_VERSION"] = "DELETE_VERSION";
|
|
256
|
+
BaseAction["SUBMIT"] = "SUBMIT";
|
|
257
|
+
BaseAction["PUT_BACK"] = "PUT_BACK";
|
|
258
|
+
BaseAction["APPROVE"] = "APPROVE";
|
|
259
|
+
BaseAction["REJECT"] = "REJECT";
|
|
260
|
+
BaseAction["RELEASE"] = "RELEASE";
|
|
261
|
+
BaseAction["WITHDRAW"] = "WITHDRAW";
|
|
262
|
+
return BaseAction;
|
|
263
|
+
}({});
|
|
264
|
+
|
|
265
|
+
var BaseResource = /*#__PURE__*/ function(BaseResource) {
|
|
266
|
+
BaseResource["ARTICLE"] = "ARTICLE";
|
|
267
|
+
BaseResource["CATEGORY"] = "CATEGORY";
|
|
268
|
+
return BaseResource;
|
|
269
|
+
}({});
|
|
270
|
+
|
|
249
271
|
function _ts_decorate$r(decorators, target, key, desc) {
|
|
250
272
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
251
273
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -352,7 +374,12 @@ class ArticleMutations {
|
|
|
352
374
|
}
|
|
353
375
|
_ts_decorate$r([
|
|
354
376
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
355
|
-
memberBaseNestjsModule.
|
|
377
|
+
memberBaseNestjsModule.AllowActions([
|
|
378
|
+
[
|
|
379
|
+
BaseResource.ARTICLE,
|
|
380
|
+
BaseAction.CREATE
|
|
381
|
+
]
|
|
382
|
+
]),
|
|
356
383
|
_ts_param$8(0, memberBaseNestjsModule.MemberId()),
|
|
357
384
|
_ts_param$8(1, graphql.Args()),
|
|
358
385
|
_ts_metadata$p("design:type", Function),
|
|
@@ -364,7 +391,12 @@ _ts_decorate$r([
|
|
|
364
391
|
], ArticleMutations.prototype, "createArticle", null);
|
|
365
392
|
_ts_decorate$r([
|
|
366
393
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
367
|
-
memberBaseNestjsModule.
|
|
394
|
+
memberBaseNestjsModule.AllowActions([
|
|
395
|
+
[
|
|
396
|
+
BaseResource.ARTICLE,
|
|
397
|
+
BaseAction.UPDATE
|
|
398
|
+
]
|
|
399
|
+
]),
|
|
368
400
|
_ts_param$8(0, memberBaseNestjsModule.MemberId()),
|
|
369
401
|
_ts_param$8(1, graphql.Args()),
|
|
370
402
|
_ts_metadata$p("design:type", Function),
|
|
@@ -376,7 +408,12 @@ _ts_decorate$r([
|
|
|
376
408
|
], ArticleMutations.prototype, "updateArticle", null);
|
|
377
409
|
_ts_decorate$r([
|
|
378
410
|
graphql.Mutation(()=>Boolean),
|
|
379
|
-
memberBaseNestjsModule.
|
|
411
|
+
memberBaseNestjsModule.AllowActions([
|
|
412
|
+
[
|
|
413
|
+
BaseResource.ARTICLE,
|
|
414
|
+
BaseAction.DELETE
|
|
415
|
+
]
|
|
416
|
+
]),
|
|
380
417
|
_ts_param$8(0, graphql.Args('id', {
|
|
381
418
|
type: ()=>graphql.ID
|
|
382
419
|
})),
|
|
@@ -388,7 +425,12 @@ _ts_decorate$r([
|
|
|
388
425
|
], ArticleMutations.prototype, "deleteArticle", null);
|
|
389
426
|
_ts_decorate$r([
|
|
390
427
|
graphql.Mutation(()=>Boolean),
|
|
391
|
-
memberBaseNestjsModule.
|
|
428
|
+
memberBaseNestjsModule.AllowActions([
|
|
429
|
+
[
|
|
430
|
+
BaseResource.ARTICLE,
|
|
431
|
+
BaseAction.DELETE_VERSION
|
|
432
|
+
]
|
|
433
|
+
]),
|
|
392
434
|
_ts_param$8(0, graphql.Args('id', {
|
|
393
435
|
type: ()=>graphql.ID
|
|
394
436
|
})),
|
|
@@ -404,7 +446,12 @@ _ts_decorate$r([
|
|
|
404
446
|
], ArticleMutations.prototype, "deleteArticleVersion", null);
|
|
405
447
|
_ts_decorate$r([
|
|
406
448
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
407
|
-
memberBaseNestjsModule.
|
|
449
|
+
memberBaseNestjsModule.AllowActions([
|
|
450
|
+
[
|
|
451
|
+
BaseResource.ARTICLE,
|
|
452
|
+
BaseAction.SUBMIT
|
|
453
|
+
]
|
|
454
|
+
]),
|
|
408
455
|
_ts_param$8(0, memberBaseNestjsModule.MemberId()),
|
|
409
456
|
_ts_param$8(1, graphql.Args('id', {
|
|
410
457
|
type: ()=>graphql.ID
|
|
@@ -418,7 +465,12 @@ _ts_decorate$r([
|
|
|
418
465
|
], ArticleMutations.prototype, "submitArticle", null);
|
|
419
466
|
_ts_decorate$r([
|
|
420
467
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
421
|
-
memberBaseNestjsModule.
|
|
468
|
+
memberBaseNestjsModule.AllowActions([
|
|
469
|
+
[
|
|
470
|
+
BaseResource.ARTICLE,
|
|
471
|
+
BaseAction.PUT_BACK
|
|
472
|
+
]
|
|
473
|
+
]),
|
|
422
474
|
_ts_param$8(0, memberBaseNestjsModule.MemberId()),
|
|
423
475
|
_ts_param$8(1, graphql.Args('id', {
|
|
424
476
|
type: ()=>graphql.ID
|
|
@@ -432,7 +484,12 @@ _ts_decorate$r([
|
|
|
432
484
|
], ArticleMutations.prototype, "putBackArticle", null);
|
|
433
485
|
_ts_decorate$r([
|
|
434
486
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
435
|
-
memberBaseNestjsModule.
|
|
487
|
+
memberBaseNestjsModule.AllowActions([
|
|
488
|
+
[
|
|
489
|
+
BaseResource.ARTICLE,
|
|
490
|
+
BaseAction.APPROVE
|
|
491
|
+
]
|
|
492
|
+
]),
|
|
436
493
|
_ts_param$8(0, graphql.Args('id', {
|
|
437
494
|
type: ()=>graphql.ID
|
|
438
495
|
})),
|
|
@@ -449,7 +506,12 @@ _ts_decorate$r([
|
|
|
449
506
|
], ArticleMutations.prototype, "approveArticle", null);
|
|
450
507
|
_ts_decorate$r([
|
|
451
508
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
452
|
-
memberBaseNestjsModule.
|
|
509
|
+
memberBaseNestjsModule.AllowActions([
|
|
510
|
+
[
|
|
511
|
+
BaseResource.ARTICLE,
|
|
512
|
+
BaseAction.REJECT
|
|
513
|
+
]
|
|
514
|
+
]),
|
|
453
515
|
_ts_param$8(0, graphql.Args('id', {
|
|
454
516
|
type: ()=>graphql.ID
|
|
455
517
|
})),
|
|
@@ -466,7 +528,12 @@ _ts_decorate$r([
|
|
|
466
528
|
], ArticleMutations.prototype, "rejectArticle", null);
|
|
467
529
|
_ts_decorate$r([
|
|
468
530
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
469
|
-
memberBaseNestjsModule.
|
|
531
|
+
memberBaseNestjsModule.AllowActions([
|
|
532
|
+
[
|
|
533
|
+
BaseResource.ARTICLE,
|
|
534
|
+
BaseAction.RELEASE
|
|
535
|
+
]
|
|
536
|
+
]),
|
|
470
537
|
_ts_param$8(0, memberBaseNestjsModule.MemberId()),
|
|
471
538
|
_ts_param$8(1, graphql.Args('id', {
|
|
472
539
|
type: ()=>graphql.ID
|
|
@@ -489,7 +556,12 @@ _ts_decorate$r([
|
|
|
489
556
|
], ArticleMutations.prototype, "releaseArticle", null);
|
|
490
557
|
_ts_decorate$r([
|
|
491
558
|
graphql.Mutation(()=>BackstageArticleDto),
|
|
492
|
-
memberBaseNestjsModule.
|
|
559
|
+
memberBaseNestjsModule.AllowActions([
|
|
560
|
+
[
|
|
561
|
+
BaseResource.ARTICLE,
|
|
562
|
+
BaseAction.WITHDRAW
|
|
563
|
+
]
|
|
564
|
+
]),
|
|
493
565
|
_ts_param$8(0, graphql.Args('id', {
|
|
494
566
|
type: ()=>graphql.ID
|
|
495
567
|
})),
|
|
@@ -648,26 +720,40 @@ function _ts_param$7(paramIndex, decorator) {
|
|
|
648
720
|
};
|
|
649
721
|
}
|
|
650
722
|
class CategoryMutations {
|
|
723
|
+
multiLanguage;
|
|
651
724
|
categoryService;
|
|
652
|
-
constructor(categoryService){
|
|
725
|
+
constructor(multiLanguage, categoryService){
|
|
726
|
+
this.multiLanguage = multiLanguage;
|
|
653
727
|
this.categoryService = categoryService;
|
|
654
728
|
}
|
|
729
|
+
resolveCreateCategoryArgs(args) {
|
|
730
|
+
const basePayload = {
|
|
731
|
+
parentIds: args.parentIds
|
|
732
|
+
};
|
|
733
|
+
if (!this.multiLanguage) {
|
|
734
|
+
const [content] = args.multiLanguageNames;
|
|
735
|
+
return {
|
|
736
|
+
...basePayload,
|
|
737
|
+
name: content.name
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
const multiLanguageNames = Object.fromEntries(args.multiLanguageNames.map((name)=>[
|
|
741
|
+
name.language,
|
|
742
|
+
name.name
|
|
743
|
+
]));
|
|
744
|
+
return {
|
|
745
|
+
...basePayload,
|
|
746
|
+
multiLanguageNames
|
|
747
|
+
};
|
|
748
|
+
}
|
|
655
749
|
createCategory(args) {
|
|
656
750
|
return this.categoryService.create({
|
|
657
|
-
...args
|
|
658
|
-
multiLanguageNames: Object.fromEntries(args.multiLanguageNames.map((name)=>[
|
|
659
|
-
name.language,
|
|
660
|
-
name.name
|
|
661
|
-
]))
|
|
751
|
+
...this.resolveCreateCategoryArgs(args)
|
|
662
752
|
});
|
|
663
753
|
}
|
|
664
754
|
updateCategory(args) {
|
|
665
755
|
return this.categoryService.update(args.id, {
|
|
666
|
-
...args
|
|
667
|
-
multiLanguageNames: Object.fromEntries(args.multiLanguageNames.map((name)=>[
|
|
668
|
-
name.language,
|
|
669
|
-
name.name
|
|
670
|
-
]))
|
|
756
|
+
...this.resolveCreateCategoryArgs(args)
|
|
671
757
|
});
|
|
672
758
|
}
|
|
673
759
|
async deleteCategory(id) {
|
|
@@ -677,7 +763,12 @@ class CategoryMutations {
|
|
|
677
763
|
}
|
|
678
764
|
_ts_decorate$l([
|
|
679
765
|
graphql.Mutation(()=>BackstageCategoryDto),
|
|
680
|
-
memberBaseNestjsModule.
|
|
766
|
+
memberBaseNestjsModule.AllowActions([
|
|
767
|
+
[
|
|
768
|
+
BaseResource.CATEGORY,
|
|
769
|
+
BaseAction.CREATE
|
|
770
|
+
]
|
|
771
|
+
]),
|
|
681
772
|
_ts_param$7(0, graphql.Args()),
|
|
682
773
|
_ts_metadata$k("design:type", Function),
|
|
683
774
|
_ts_metadata$k("design:paramtypes", [
|
|
@@ -687,7 +778,12 @@ _ts_decorate$l([
|
|
|
687
778
|
], CategoryMutations.prototype, "createCategory", null);
|
|
688
779
|
_ts_decorate$l([
|
|
689
780
|
graphql.Mutation(()=>BackstageCategoryDto),
|
|
690
|
-
memberBaseNestjsModule.
|
|
781
|
+
memberBaseNestjsModule.AllowActions([
|
|
782
|
+
[
|
|
783
|
+
BaseResource.CATEGORY,
|
|
784
|
+
BaseAction.UPDATE
|
|
785
|
+
]
|
|
786
|
+
]),
|
|
691
787
|
_ts_param$7(0, graphql.Args()),
|
|
692
788
|
_ts_metadata$k("design:type", Function),
|
|
693
789
|
_ts_metadata$k("design:paramtypes", [
|
|
@@ -697,7 +793,12 @@ _ts_decorate$l([
|
|
|
697
793
|
], CategoryMutations.prototype, "updateCategory", null);
|
|
698
794
|
_ts_decorate$l([
|
|
699
795
|
graphql.Mutation(()=>Boolean),
|
|
700
|
-
memberBaseNestjsModule.
|
|
796
|
+
memberBaseNestjsModule.AllowActions([
|
|
797
|
+
[
|
|
798
|
+
BaseResource.CATEGORY,
|
|
799
|
+
BaseAction.DELETE
|
|
800
|
+
]
|
|
801
|
+
]),
|
|
701
802
|
_ts_param$7(0, graphql.Args('id', {
|
|
702
803
|
type: ()=>graphql.ID
|
|
703
804
|
})),
|
|
@@ -709,8 +810,10 @@ _ts_decorate$l([
|
|
|
709
810
|
], CategoryMutations.prototype, "deleteCategory", null);
|
|
710
811
|
CategoryMutations = _ts_decorate$l([
|
|
711
812
|
graphql.Resolver(),
|
|
813
|
+
_ts_param$7(0, common.Inject(cmsBaseNestjsModule.MULTIPLE_LANGUAGE_MODE)),
|
|
712
814
|
_ts_metadata$k("design:type", Function),
|
|
713
815
|
_ts_metadata$k("design:paramtypes", [
|
|
816
|
+
Boolean,
|
|
714
817
|
typeof cmsBaseNestjsModule.CategoryBaseService === "undefined" ? Object : cmsBaseNestjsModule.CategoryBaseService
|
|
715
818
|
])
|
|
716
819
|
], CategoryMutations);
|
|
@@ -988,7 +1091,12 @@ _ts_decorate$e([
|
|
|
988
1091
|
], ArticleQueries.prototype, "articles", null);
|
|
989
1092
|
_ts_decorate$e([
|
|
990
1093
|
graphql.Query(()=>BackstageArticleDto),
|
|
991
|
-
memberBaseNestjsModule.
|
|
1094
|
+
memberBaseNestjsModule.AllowActions([
|
|
1095
|
+
[
|
|
1096
|
+
BaseResource.ARTICLE,
|
|
1097
|
+
BaseAction.READ
|
|
1098
|
+
]
|
|
1099
|
+
]),
|
|
992
1100
|
_ts_param$6(0, graphql.Args('id', {
|
|
993
1101
|
type: ()=>graphql.ID
|
|
994
1102
|
})),
|
|
@@ -1005,7 +1113,12 @@ _ts_decorate$e([
|
|
|
1005
1113
|
], ArticleQueries.prototype, "backstageArticle", null);
|
|
1006
1114
|
_ts_decorate$e([
|
|
1007
1115
|
graphql.Query(()=>BackstageArticleCollectionDto),
|
|
1008
|
-
memberBaseNestjsModule.
|
|
1116
|
+
memberBaseNestjsModule.AllowActions([
|
|
1117
|
+
[
|
|
1118
|
+
BaseResource.ARTICLE,
|
|
1119
|
+
BaseAction.LIST
|
|
1120
|
+
]
|
|
1121
|
+
]),
|
|
1009
1122
|
_ts_param$6(0, graphql.Args()),
|
|
1010
1123
|
_ts_metadata$d("design:type", Function),
|
|
1011
1124
|
_ts_metadata$d("design:paramtypes", [
|
|
@@ -1098,17 +1211,22 @@ function _ts_param$5(paramIndex, decorator) {
|
|
|
1098
1211
|
};
|
|
1099
1212
|
}
|
|
1100
1213
|
class CategoryQueries {
|
|
1214
|
+
multiLanguage;
|
|
1101
1215
|
categoryService;
|
|
1102
|
-
constructor(categoryService){
|
|
1216
|
+
constructor(multiLanguage, categoryService){
|
|
1217
|
+
this.multiLanguage = multiLanguage;
|
|
1103
1218
|
this.categoryService = categoryService;
|
|
1104
1219
|
}
|
|
1105
|
-
category(id, language = cmsBaseNestjsModule.DEFAULT_LANGUAGE) {
|
|
1106
|
-
|
|
1220
|
+
async category(id, language = cmsBaseNestjsModule.DEFAULT_LANGUAGE) {
|
|
1221
|
+
if (this.multiLanguage) {
|
|
1222
|
+
return this.categoryService.findById(id, language);
|
|
1223
|
+
}
|
|
1224
|
+
return this.categoryService.findById(id);
|
|
1107
1225
|
}
|
|
1108
1226
|
categories(args, language = cmsBaseNestjsModule.DEFAULT_LANGUAGE) {
|
|
1109
1227
|
return this.categoryService.findAll({
|
|
1110
1228
|
...args,
|
|
1111
|
-
language
|
|
1229
|
+
language: this.multiLanguage ? language : null
|
|
1112
1230
|
});
|
|
1113
1231
|
}
|
|
1114
1232
|
backstageCategory(id) {
|
|
@@ -1130,7 +1248,7 @@ _ts_decorate$b([
|
|
|
1130
1248
|
String,
|
|
1131
1249
|
String
|
|
1132
1250
|
]),
|
|
1133
|
-
_ts_metadata$a("design:returntype",
|
|
1251
|
+
_ts_metadata$a("design:returntype", Promise)
|
|
1134
1252
|
], CategoryQueries.prototype, "category", null);
|
|
1135
1253
|
_ts_decorate$b([
|
|
1136
1254
|
graphql.Query(()=>[
|
|
@@ -1148,7 +1266,12 @@ _ts_decorate$b([
|
|
|
1148
1266
|
], CategoryQueries.prototype, "categories", null);
|
|
1149
1267
|
_ts_decorate$b([
|
|
1150
1268
|
graphql.Query(()=>BackstageCategoryDto),
|
|
1151
|
-
memberBaseNestjsModule.
|
|
1269
|
+
memberBaseNestjsModule.AllowActions([
|
|
1270
|
+
[
|
|
1271
|
+
BaseResource.CATEGORY,
|
|
1272
|
+
BaseAction.READ
|
|
1273
|
+
]
|
|
1274
|
+
]),
|
|
1152
1275
|
_ts_param$5(0, graphql.Args('id', {
|
|
1153
1276
|
type: ()=>graphql.ID
|
|
1154
1277
|
})),
|
|
@@ -1162,7 +1285,12 @@ _ts_decorate$b([
|
|
|
1162
1285
|
graphql.Query(()=>[
|
|
1163
1286
|
BackstageCategoryDto
|
|
1164
1287
|
]),
|
|
1165
|
-
memberBaseNestjsModule.
|
|
1288
|
+
memberBaseNestjsModule.AllowActions([
|
|
1289
|
+
[
|
|
1290
|
+
BaseResource.CATEGORY,
|
|
1291
|
+
BaseAction.LIST
|
|
1292
|
+
]
|
|
1293
|
+
]),
|
|
1166
1294
|
_ts_param$5(0, graphql.Args()),
|
|
1167
1295
|
_ts_metadata$a("design:type", Function),
|
|
1168
1296
|
_ts_metadata$a("design:paramtypes", [
|
|
@@ -1172,8 +1300,10 @@ _ts_decorate$b([
|
|
|
1172
1300
|
], CategoryQueries.prototype, "backstageCategories", null);
|
|
1173
1301
|
CategoryQueries = _ts_decorate$b([
|
|
1174
1302
|
graphql.Resolver(),
|
|
1303
|
+
_ts_param$5(0, common.Inject(cmsBaseNestjsModule.MULTIPLE_LANGUAGE_MODE)),
|
|
1175
1304
|
_ts_metadata$a("design:type", Function),
|
|
1176
1305
|
_ts_metadata$a("design:paramtypes", [
|
|
1306
|
+
Boolean,
|
|
1177
1307
|
typeof cmsBaseNestjsModule.CategoryBaseService === "undefined" ? Object : cmsBaseNestjsModule.CategoryBaseService
|
|
1178
1308
|
])
|
|
1179
1309
|
], CategoryQueries);
|
|
@@ -1636,7 +1766,7 @@ class BackstageArticleResolver {
|
|
|
1636
1766
|
}
|
|
1637
1767
|
_ts_decorate$3([
|
|
1638
1768
|
graphql.ResolveField(()=>graphql.ID),
|
|
1639
|
-
memberBaseNestjsModule.
|
|
1769
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1640
1770
|
_ts_param$1(0, graphql.Root()),
|
|
1641
1771
|
_ts_metadata$2("design:type", Function),
|
|
1642
1772
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1646,7 +1776,7 @@ _ts_decorate$3([
|
|
|
1646
1776
|
], BackstageArticleResolver.prototype, "id", null);
|
|
1647
1777
|
_ts_decorate$3([
|
|
1648
1778
|
graphql.ResolveField(()=>String),
|
|
1649
|
-
memberBaseNestjsModule.
|
|
1779
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1650
1780
|
_ts_param$1(0, graphql.Root()),
|
|
1651
1781
|
_ts_metadata$2("design:type", Function),
|
|
1652
1782
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1658,7 +1788,7 @@ _ts_decorate$3([
|
|
|
1658
1788
|
graphql.ResolveField(()=>UserDto, {
|
|
1659
1789
|
nullable: true
|
|
1660
1790
|
}),
|
|
1661
|
-
memberBaseNestjsModule.
|
|
1791
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1662
1792
|
_ts_param$1(0, graphql.Root()),
|
|
1663
1793
|
_ts_metadata$2("design:type", Function),
|
|
1664
1794
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1670,7 +1800,7 @@ _ts_decorate$3([
|
|
|
1670
1800
|
graphql.ResolveField(()=>UserDto, {
|
|
1671
1801
|
nullable: true
|
|
1672
1802
|
}),
|
|
1673
|
-
memberBaseNestjsModule.
|
|
1803
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1674
1804
|
_ts_param$1(0, graphql.Root()),
|
|
1675
1805
|
_ts_metadata$2("design:type", Function),
|
|
1676
1806
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1682,7 +1812,7 @@ _ts_decorate$3([
|
|
|
1682
1812
|
graphql.ResolveField(()=>UserDto, {
|
|
1683
1813
|
nullable: true
|
|
1684
1814
|
}),
|
|
1685
|
-
memberBaseNestjsModule.
|
|
1815
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1686
1816
|
_ts_param$1(0, graphql.Root()),
|
|
1687
1817
|
_ts_metadata$2("design:type", Function),
|
|
1688
1818
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1694,7 +1824,7 @@ _ts_decorate$3([
|
|
|
1694
1824
|
graphql.ResolveField(()=>[
|
|
1695
1825
|
CategoryDto
|
|
1696
1826
|
]),
|
|
1697
|
-
memberBaseNestjsModule.
|
|
1827
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1698
1828
|
_ts_param$1(0, graphql.Root()),
|
|
1699
1829
|
_ts_param$1(1, Language()),
|
|
1700
1830
|
_ts_metadata$2("design:type", Function),
|
|
@@ -1706,7 +1836,7 @@ _ts_decorate$3([
|
|
|
1706
1836
|
], BackstageArticleResolver.prototype, "categories", null);
|
|
1707
1837
|
_ts_decorate$3([
|
|
1708
1838
|
graphql.ResolveField(()=>String),
|
|
1709
|
-
memberBaseNestjsModule.
|
|
1839
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1710
1840
|
_ts_param$1(0, graphql.Root()),
|
|
1711
1841
|
_ts_metadata$2("design:type", Function),
|
|
1712
1842
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1718,7 +1848,7 @@ _ts_decorate$3([
|
|
|
1718
1848
|
graphql.ResolveField(()=>String, {
|
|
1719
1849
|
nullable: true
|
|
1720
1850
|
}),
|
|
1721
|
-
memberBaseNestjsModule.
|
|
1851
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1722
1852
|
_ts_param$1(0, graphql.Root()),
|
|
1723
1853
|
_ts_metadata$2("design:type", Function),
|
|
1724
1854
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1728,7 +1858,7 @@ _ts_decorate$3([
|
|
|
1728
1858
|
], BackstageArticleResolver.prototype, "description", null);
|
|
1729
1859
|
_ts_decorate$3([
|
|
1730
1860
|
graphql.ResolveField(()=>QuadratsContentScalar),
|
|
1731
|
-
memberBaseNestjsModule.
|
|
1861
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1732
1862
|
_ts_param$1(0, graphql.Root()),
|
|
1733
1863
|
_ts_metadata$2("design:type", Function),
|
|
1734
1864
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1740,7 +1870,7 @@ _ts_decorate$3([
|
|
|
1740
1870
|
graphql.ResolveField(()=>[
|
|
1741
1871
|
ArticleMultiLanguageContentDto
|
|
1742
1872
|
]),
|
|
1743
|
-
memberBaseNestjsModule.
|
|
1873
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1744
1874
|
_ts_param$1(0, graphql.Root()),
|
|
1745
1875
|
_ts_metadata$2("design:type", Function),
|
|
1746
1876
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1752,7 +1882,7 @@ _ts_decorate$3([
|
|
|
1752
1882
|
graphql.ResolveField(()=>[
|
|
1753
1883
|
BackstageArticleDto
|
|
1754
1884
|
]),
|
|
1755
|
-
memberBaseNestjsModule.
|
|
1885
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1756
1886
|
_ts_param$1(0, graphql.Root()),
|
|
1757
1887
|
_ts_metadata$2("design:type", Function),
|
|
1758
1888
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1762,7 +1892,7 @@ _ts_decorate$3([
|
|
|
1762
1892
|
], BackstageArticleResolver.prototype, "versions", null);
|
|
1763
1893
|
_ts_decorate$3([
|
|
1764
1894
|
graphql.ResolveField(()=>cmsBaseNestjsModule.ArticleStage),
|
|
1765
|
-
memberBaseNestjsModule.
|
|
1895
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1766
1896
|
_ts_param$1(0, graphql.Root()),
|
|
1767
1897
|
_ts_metadata$2("design:type", Function),
|
|
1768
1898
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1774,7 +1904,7 @@ _ts_decorate$3([
|
|
|
1774
1904
|
graphql.ResolveField(()=>[
|
|
1775
1905
|
ArticleSignatureDto
|
|
1776
1906
|
]),
|
|
1777
|
-
memberBaseNestjsModule.
|
|
1907
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1778
1908
|
_ts_param$1(0, graphql.Root()),
|
|
1779
1909
|
_ts_metadata$2("design:type", Function),
|
|
1780
1910
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1784,7 +1914,7 @@ _ts_decorate$3([
|
|
|
1784
1914
|
], BackstageArticleResolver.prototype, "signatures", null);
|
|
1785
1915
|
_ts_decorate$3([
|
|
1786
1916
|
graphql.ResolveField(()=>ArticleStageVersionDto),
|
|
1787
|
-
memberBaseNestjsModule.
|
|
1917
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1788
1918
|
_ts_param$1(0, graphql.Root()),
|
|
1789
1919
|
_ts_metadata$2("design:type", Function),
|
|
1790
1920
|
_ts_metadata$2("design:paramtypes", [
|
|
@@ -1864,7 +1994,7 @@ _ts_decorate$1([
|
|
|
1864
1994
|
graphql.ResolveField(()=>UserDto, {
|
|
1865
1995
|
nullable: true
|
|
1866
1996
|
}),
|
|
1867
|
-
memberBaseNestjsModule.
|
|
1997
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1868
1998
|
_ts_param(0, graphql.Root()),
|
|
1869
1999
|
_ts_metadata("design:type", Function),
|
|
1870
2000
|
_ts_metadata("design:paramtypes", [
|
|
@@ -1874,7 +2004,7 @@ _ts_decorate$1([
|
|
|
1874
2004
|
], ArticleSignatureResolver.prototype, "signer", null);
|
|
1875
2005
|
_ts_decorate$1([
|
|
1876
2006
|
graphql.ResolveField(()=>ArticleSignatureStepDto),
|
|
1877
|
-
memberBaseNestjsModule.
|
|
2007
|
+
memberBaseNestjsModule.Authenticated(),
|
|
1878
2008
|
_ts_param(0, graphql.Root()),
|
|
1879
2009
|
_ts_metadata("design:type", Function),
|
|
1880
2010
|
_ts_metadata("design:paramtypes", [
|
|
@@ -2,9 +2,11 @@ import { MULTIPLE_LANGUAGE_MODE, ArticleBaseService, DEFAULT_LANGUAGE } from '@r
|
|
|
2
2
|
import { Mutation, Args, ID, Int, Resolver } from '@nestjs/graphql';
|
|
3
3
|
import { BackstageArticleDto } from '../dto/backstage-article.dto.js';
|
|
4
4
|
import { CreateArticleArgs } from '../dto/create-article.args.js';
|
|
5
|
-
import {
|
|
5
|
+
import { AllowActions, MemberId } from '@rytass/member-base-nestjs-module';
|
|
6
6
|
import { UpdateArticleArgs } from '../dto/update-article.args.js';
|
|
7
7
|
import { Inject } from '@nestjs/common';
|
|
8
|
+
import { BaseAction } from '../constants/enum/base-action.enum.js';
|
|
9
|
+
import { BaseResource } from '../constants/enum/base-resource.enum.js';
|
|
8
10
|
|
|
9
11
|
function _ts_decorate(decorators, target, key, desc) {
|
|
10
12
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -112,7 +114,12 @@ class ArticleMutations {
|
|
|
112
114
|
}
|
|
113
115
|
_ts_decorate([
|
|
114
116
|
Mutation(()=>BackstageArticleDto),
|
|
115
|
-
|
|
117
|
+
AllowActions([
|
|
118
|
+
[
|
|
119
|
+
BaseResource.ARTICLE,
|
|
120
|
+
BaseAction.CREATE
|
|
121
|
+
]
|
|
122
|
+
]),
|
|
116
123
|
_ts_param(0, MemberId()),
|
|
117
124
|
_ts_param(1, Args()),
|
|
118
125
|
_ts_metadata("design:type", Function),
|
|
@@ -124,7 +131,12 @@ _ts_decorate([
|
|
|
124
131
|
], ArticleMutations.prototype, "createArticle", null);
|
|
125
132
|
_ts_decorate([
|
|
126
133
|
Mutation(()=>BackstageArticleDto),
|
|
127
|
-
|
|
134
|
+
AllowActions([
|
|
135
|
+
[
|
|
136
|
+
BaseResource.ARTICLE,
|
|
137
|
+
BaseAction.UPDATE
|
|
138
|
+
]
|
|
139
|
+
]),
|
|
128
140
|
_ts_param(0, MemberId()),
|
|
129
141
|
_ts_param(1, Args()),
|
|
130
142
|
_ts_metadata("design:type", Function),
|
|
@@ -136,7 +148,12 @@ _ts_decorate([
|
|
|
136
148
|
], ArticleMutations.prototype, "updateArticle", null);
|
|
137
149
|
_ts_decorate([
|
|
138
150
|
Mutation(()=>Boolean),
|
|
139
|
-
|
|
151
|
+
AllowActions([
|
|
152
|
+
[
|
|
153
|
+
BaseResource.ARTICLE,
|
|
154
|
+
BaseAction.DELETE
|
|
155
|
+
]
|
|
156
|
+
]),
|
|
140
157
|
_ts_param(0, Args('id', {
|
|
141
158
|
type: ()=>ID
|
|
142
159
|
})),
|
|
@@ -148,7 +165,12 @@ _ts_decorate([
|
|
|
148
165
|
], ArticleMutations.prototype, "deleteArticle", null);
|
|
149
166
|
_ts_decorate([
|
|
150
167
|
Mutation(()=>Boolean),
|
|
151
|
-
|
|
168
|
+
AllowActions([
|
|
169
|
+
[
|
|
170
|
+
BaseResource.ARTICLE,
|
|
171
|
+
BaseAction.DELETE_VERSION
|
|
172
|
+
]
|
|
173
|
+
]),
|
|
152
174
|
_ts_param(0, Args('id', {
|
|
153
175
|
type: ()=>ID
|
|
154
176
|
})),
|
|
@@ -164,7 +186,12 @@ _ts_decorate([
|
|
|
164
186
|
], ArticleMutations.prototype, "deleteArticleVersion", null);
|
|
165
187
|
_ts_decorate([
|
|
166
188
|
Mutation(()=>BackstageArticleDto),
|
|
167
|
-
|
|
189
|
+
AllowActions([
|
|
190
|
+
[
|
|
191
|
+
BaseResource.ARTICLE,
|
|
192
|
+
BaseAction.SUBMIT
|
|
193
|
+
]
|
|
194
|
+
]),
|
|
168
195
|
_ts_param(0, MemberId()),
|
|
169
196
|
_ts_param(1, Args('id', {
|
|
170
197
|
type: ()=>ID
|
|
@@ -178,7 +205,12 @@ _ts_decorate([
|
|
|
178
205
|
], ArticleMutations.prototype, "submitArticle", null);
|
|
179
206
|
_ts_decorate([
|
|
180
207
|
Mutation(()=>BackstageArticleDto),
|
|
181
|
-
|
|
208
|
+
AllowActions([
|
|
209
|
+
[
|
|
210
|
+
BaseResource.ARTICLE,
|
|
211
|
+
BaseAction.PUT_BACK
|
|
212
|
+
]
|
|
213
|
+
]),
|
|
182
214
|
_ts_param(0, MemberId()),
|
|
183
215
|
_ts_param(1, Args('id', {
|
|
184
216
|
type: ()=>ID
|
|
@@ -192,7 +224,12 @@ _ts_decorate([
|
|
|
192
224
|
], ArticleMutations.prototype, "putBackArticle", null);
|
|
193
225
|
_ts_decorate([
|
|
194
226
|
Mutation(()=>BackstageArticleDto),
|
|
195
|
-
|
|
227
|
+
AllowActions([
|
|
228
|
+
[
|
|
229
|
+
BaseResource.ARTICLE,
|
|
230
|
+
BaseAction.APPROVE
|
|
231
|
+
]
|
|
232
|
+
]),
|
|
196
233
|
_ts_param(0, Args('id', {
|
|
197
234
|
type: ()=>ID
|
|
198
235
|
})),
|
|
@@ -209,7 +246,12 @@ _ts_decorate([
|
|
|
209
246
|
], ArticleMutations.prototype, "approveArticle", null);
|
|
210
247
|
_ts_decorate([
|
|
211
248
|
Mutation(()=>BackstageArticleDto),
|
|
212
|
-
|
|
249
|
+
AllowActions([
|
|
250
|
+
[
|
|
251
|
+
BaseResource.ARTICLE,
|
|
252
|
+
BaseAction.REJECT
|
|
253
|
+
]
|
|
254
|
+
]),
|
|
213
255
|
_ts_param(0, Args('id', {
|
|
214
256
|
type: ()=>ID
|
|
215
257
|
})),
|
|
@@ -226,7 +268,12 @@ _ts_decorate([
|
|
|
226
268
|
], ArticleMutations.prototype, "rejectArticle", null);
|
|
227
269
|
_ts_decorate([
|
|
228
270
|
Mutation(()=>BackstageArticleDto),
|
|
229
|
-
|
|
271
|
+
AllowActions([
|
|
272
|
+
[
|
|
273
|
+
BaseResource.ARTICLE,
|
|
274
|
+
BaseAction.RELEASE
|
|
275
|
+
]
|
|
276
|
+
]),
|
|
230
277
|
_ts_param(0, MemberId()),
|
|
231
278
|
_ts_param(1, Args('id', {
|
|
232
279
|
type: ()=>ID
|
|
@@ -249,7 +296,12 @@ _ts_decorate([
|
|
|
249
296
|
], ArticleMutations.prototype, "releaseArticle", null);
|
|
250
297
|
_ts_decorate([
|
|
251
298
|
Mutation(()=>BackstageArticleDto),
|
|
252
|
-
|
|
299
|
+
AllowActions([
|
|
300
|
+
[
|
|
301
|
+
BaseResource.ARTICLE,
|
|
302
|
+
BaseAction.WITHDRAW
|
|
303
|
+
]
|
|
304
|
+
]),
|
|
253
305
|
_ts_param(0, Args('id', {
|
|
254
306
|
type: ()=>ID
|
|
255
307
|
})),
|
|
@@ -3,8 +3,10 @@ import { CreateCategoryArgs } from '../dto/create-category.args';
|
|
|
3
3
|
import { BackstageCategoryDto } from '../dto/backstage-category.dto';
|
|
4
4
|
import { UpdateCategoryArgs } from '../dto/update-category.args';
|
|
5
5
|
export declare class CategoryMutations {
|
|
6
|
+
private readonly multiLanguage;
|
|
6
7
|
private readonly categoryService;
|
|
7
|
-
constructor(categoryService: CategoryBaseService);
|
|
8
|
+
constructor(multiLanguage: boolean, categoryService: CategoryBaseService);
|
|
9
|
+
private resolveCreateCategoryArgs;
|
|
8
10
|
createCategory(args: CreateCategoryArgs): Promise<BackstageCategoryDto>;
|
|
9
11
|
updateCategory(args: UpdateCategoryArgs): Promise<BackstageCategoryDto>;
|
|
10
12
|
deleteCategory(id: string): Promise<boolean>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Mutation, Args, ID, Resolver } from '@nestjs/graphql';
|
|
2
|
-
import { CategoryBaseService } from '@rytass/cms-base-nestjs-module';
|
|
2
|
+
import { MULTIPLE_LANGUAGE_MODE, CategoryBaseService } from '@rytass/cms-base-nestjs-module';
|
|
3
3
|
import { CreateCategoryArgs } from '../dto/create-category.args.js';
|
|
4
|
-
import {
|
|
4
|
+
import { AllowActions } from '@rytass/member-base-nestjs-module';
|
|
5
5
|
import { BackstageCategoryDto } from '../dto/backstage-category.dto.js';
|
|
6
6
|
import { UpdateCategoryArgs } from '../dto/update-category.args.js';
|
|
7
|
+
import { Inject } from '@nestjs/common';
|
|
8
|
+
import { BaseAction } from '../constants/enum/base-action.enum.js';
|
|
9
|
+
import { BaseResource } from '../constants/enum/base-resource.enum.js';
|
|
7
10
|
|
|
8
11
|
function _ts_decorate(decorators, target, key, desc) {
|
|
9
12
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -20,26 +23,40 @@ function _ts_param(paramIndex, decorator) {
|
|
|
20
23
|
};
|
|
21
24
|
}
|
|
22
25
|
class CategoryMutations {
|
|
26
|
+
multiLanguage;
|
|
23
27
|
categoryService;
|
|
24
|
-
constructor(categoryService){
|
|
28
|
+
constructor(multiLanguage, categoryService){
|
|
29
|
+
this.multiLanguage = multiLanguage;
|
|
25
30
|
this.categoryService = categoryService;
|
|
26
31
|
}
|
|
32
|
+
resolveCreateCategoryArgs(args) {
|
|
33
|
+
const basePayload = {
|
|
34
|
+
parentIds: args.parentIds
|
|
35
|
+
};
|
|
36
|
+
if (!this.multiLanguage) {
|
|
37
|
+
const [content] = args.multiLanguageNames;
|
|
38
|
+
return {
|
|
39
|
+
...basePayload,
|
|
40
|
+
name: content.name
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const multiLanguageNames = Object.fromEntries(args.multiLanguageNames.map((name)=>[
|
|
44
|
+
name.language,
|
|
45
|
+
name.name
|
|
46
|
+
]));
|
|
47
|
+
return {
|
|
48
|
+
...basePayload,
|
|
49
|
+
multiLanguageNames
|
|
50
|
+
};
|
|
51
|
+
}
|
|
27
52
|
createCategory(args) {
|
|
28
53
|
return this.categoryService.create({
|
|
29
|
-
...args
|
|
30
|
-
multiLanguageNames: Object.fromEntries(args.multiLanguageNames.map((name)=>[
|
|
31
|
-
name.language,
|
|
32
|
-
name.name
|
|
33
|
-
]))
|
|
54
|
+
...this.resolveCreateCategoryArgs(args)
|
|
34
55
|
});
|
|
35
56
|
}
|
|
36
57
|
updateCategory(args) {
|
|
37
58
|
return this.categoryService.update(args.id, {
|
|
38
|
-
...args
|
|
39
|
-
multiLanguageNames: Object.fromEntries(args.multiLanguageNames.map((name)=>[
|
|
40
|
-
name.language,
|
|
41
|
-
name.name
|
|
42
|
-
]))
|
|
59
|
+
...this.resolveCreateCategoryArgs(args)
|
|
43
60
|
});
|
|
44
61
|
}
|
|
45
62
|
async deleteCategory(id) {
|
|
@@ -49,7 +66,12 @@ class CategoryMutations {
|
|
|
49
66
|
}
|
|
50
67
|
_ts_decorate([
|
|
51
68
|
Mutation(()=>BackstageCategoryDto),
|
|
52
|
-
|
|
69
|
+
AllowActions([
|
|
70
|
+
[
|
|
71
|
+
BaseResource.CATEGORY,
|
|
72
|
+
BaseAction.CREATE
|
|
73
|
+
]
|
|
74
|
+
]),
|
|
53
75
|
_ts_param(0, Args()),
|
|
54
76
|
_ts_metadata("design:type", Function),
|
|
55
77
|
_ts_metadata("design:paramtypes", [
|
|
@@ -59,7 +81,12 @@ _ts_decorate([
|
|
|
59
81
|
], CategoryMutations.prototype, "createCategory", null);
|
|
60
82
|
_ts_decorate([
|
|
61
83
|
Mutation(()=>BackstageCategoryDto),
|
|
62
|
-
|
|
84
|
+
AllowActions([
|
|
85
|
+
[
|
|
86
|
+
BaseResource.CATEGORY,
|
|
87
|
+
BaseAction.UPDATE
|
|
88
|
+
]
|
|
89
|
+
]),
|
|
63
90
|
_ts_param(0, Args()),
|
|
64
91
|
_ts_metadata("design:type", Function),
|
|
65
92
|
_ts_metadata("design:paramtypes", [
|
|
@@ -69,7 +96,12 @@ _ts_decorate([
|
|
|
69
96
|
], CategoryMutations.prototype, "updateCategory", null);
|
|
70
97
|
_ts_decorate([
|
|
71
98
|
Mutation(()=>Boolean),
|
|
72
|
-
|
|
99
|
+
AllowActions([
|
|
100
|
+
[
|
|
101
|
+
BaseResource.CATEGORY,
|
|
102
|
+
BaseAction.DELETE
|
|
103
|
+
]
|
|
104
|
+
]),
|
|
73
105
|
_ts_param(0, Args('id', {
|
|
74
106
|
type: ()=>ID
|
|
75
107
|
})),
|
|
@@ -81,8 +113,10 @@ _ts_decorate([
|
|
|
81
113
|
], CategoryMutations.prototype, "deleteCategory", null);
|
|
82
114
|
CategoryMutations = _ts_decorate([
|
|
83
115
|
Resolver(),
|
|
116
|
+
_ts_param(0, Inject(MULTIPLE_LANGUAGE_MODE)),
|
|
84
117
|
_ts_metadata("design:type", Function),
|
|
85
118
|
_ts_metadata("design:paramtypes", [
|
|
119
|
+
Boolean,
|
|
86
120
|
typeof CategoryBaseService === "undefined" ? Object : CategoryBaseService
|
|
87
121
|
])
|
|
88
122
|
], CategoryMutations);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rytass/cms-base-nestjs-graphql-module",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Rytass Content Management System NestJS Base GraphQL Module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rytass",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typeorm": "*"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@rytass/cms-base-nestjs-module": "^0.1.
|
|
29
|
+
"@rytass/cms-base-nestjs-module": "^0.1.94",
|
|
30
30
|
"@rytass/member-base-nestjs-module": "^0.1.65",
|
|
31
31
|
"dataloader": "^2.2.2",
|
|
32
32
|
"lru-cache": "^11.0.2"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Query, Args, ID, Int, Resolver } from '@nestjs/graphql';
|
|
2
2
|
import { MULTIPLE_LANGUAGE_MODE, ArticleBaseService, ArticleStage, DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
3
3
|
import { ArticlesArgs } from '../dto/articles.args.js';
|
|
4
|
-
import { IsPublic } from '@rytass/member-base-nestjs-module';
|
|
4
|
+
import { IsPublic, AllowActions } from '@rytass/member-base-nestjs-module';
|
|
5
5
|
import { Language } from '../decorators/language.decorator.js';
|
|
6
6
|
import { ArticleCollectionDto } from '../dto/article-collection.dto.js';
|
|
7
7
|
import { ArticleDto } from '../dto/article.dto.js';
|
|
@@ -9,6 +9,8 @@ import { BackstageArticleDto } from '../dto/backstage-article.dto.js';
|
|
|
9
9
|
import { BackstageArticleCollectionDto } from '../dto/backstage-article-collection.dto.js';
|
|
10
10
|
import { Inject } from '@nestjs/common';
|
|
11
11
|
import { BackstageArticleArgs } from '../dto/backstage-article.args.js';
|
|
12
|
+
import { BaseAction } from '../constants/enum/base-action.enum.js';
|
|
13
|
+
import { BaseResource } from '../constants/enum/base-resource.enum.js';
|
|
12
14
|
|
|
13
15
|
function _ts_decorate(decorators, target, key, desc) {
|
|
14
16
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -81,7 +83,12 @@ _ts_decorate([
|
|
|
81
83
|
], ArticleQueries.prototype, "articles", null);
|
|
82
84
|
_ts_decorate([
|
|
83
85
|
Query(()=>BackstageArticleDto),
|
|
84
|
-
|
|
86
|
+
AllowActions([
|
|
87
|
+
[
|
|
88
|
+
BaseResource.ARTICLE,
|
|
89
|
+
BaseAction.READ
|
|
90
|
+
]
|
|
91
|
+
]),
|
|
85
92
|
_ts_param(0, Args('id', {
|
|
86
93
|
type: ()=>ID
|
|
87
94
|
})),
|
|
@@ -98,7 +105,12 @@ _ts_decorate([
|
|
|
98
105
|
], ArticleQueries.prototype, "backstageArticle", null);
|
|
99
106
|
_ts_decorate([
|
|
100
107
|
Query(()=>BackstageArticleCollectionDto),
|
|
101
|
-
|
|
108
|
+
AllowActions([
|
|
109
|
+
[
|
|
110
|
+
BaseResource.ARTICLE,
|
|
111
|
+
BaseAction.LIST
|
|
112
|
+
]
|
|
113
|
+
]),
|
|
102
114
|
_ts_param(0, Args()),
|
|
103
115
|
_ts_metadata("design:type", Function),
|
|
104
116
|
_ts_metadata("design:paramtypes", [
|
|
@@ -3,8 +3,9 @@ import { CategoriesArgs } from '../dto/categories.args';
|
|
|
3
3
|
import { CategoryDto } from '../dto/category.dto';
|
|
4
4
|
import { BackstageCategoryDto } from '../dto/backstage-category.dto';
|
|
5
5
|
export declare class CategoryQueries {
|
|
6
|
+
private readonly multiLanguage;
|
|
6
7
|
private readonly categoryService;
|
|
7
|
-
constructor(categoryService: CategoryBaseService);
|
|
8
|
+
constructor(multiLanguage: boolean, categoryService: CategoryBaseService);
|
|
8
9
|
category(id: string, language?: string): Promise<CategoryDto>;
|
|
9
10
|
categories(args: CategoriesArgs, language?: string): Promise<CategoryDto[]>;
|
|
10
11
|
backstageCategory(id: string): Promise<BackstageCategoryDto>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Query, Args, ID, Resolver } from '@nestjs/graphql';
|
|
2
|
-
import { CategoryBaseService, DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
2
|
+
import { MULTIPLE_LANGUAGE_MODE, CategoryBaseService, DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
3
3
|
import { CategoriesArgs } from '../dto/categories.args.js';
|
|
4
|
-
import { IsPublic } from '@rytass/member-base-nestjs-module';
|
|
4
|
+
import { IsPublic, AllowActions } from '@rytass/member-base-nestjs-module';
|
|
5
5
|
import { CategoryDto } from '../dto/category.dto.js';
|
|
6
6
|
import { Language } from '../decorators/language.decorator.js';
|
|
7
7
|
import { BackstageCategoryDto } from '../dto/backstage-category.dto.js';
|
|
8
|
+
import { Inject } from '@nestjs/common';
|
|
9
|
+
import { BaseAction } from '../constants/enum/base-action.enum.js';
|
|
10
|
+
import { BaseResource } from '../constants/enum/base-resource.enum.js';
|
|
8
11
|
|
|
9
12
|
function _ts_decorate(decorators, target, key, desc) {
|
|
10
13
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -21,17 +24,22 @@ function _ts_param(paramIndex, decorator) {
|
|
|
21
24
|
};
|
|
22
25
|
}
|
|
23
26
|
class CategoryQueries {
|
|
27
|
+
multiLanguage;
|
|
24
28
|
categoryService;
|
|
25
|
-
constructor(categoryService){
|
|
29
|
+
constructor(multiLanguage, categoryService){
|
|
30
|
+
this.multiLanguage = multiLanguage;
|
|
26
31
|
this.categoryService = categoryService;
|
|
27
32
|
}
|
|
28
|
-
category(id, language = DEFAULT_LANGUAGE) {
|
|
29
|
-
|
|
33
|
+
async category(id, language = DEFAULT_LANGUAGE) {
|
|
34
|
+
if (this.multiLanguage) {
|
|
35
|
+
return this.categoryService.findById(id, language);
|
|
36
|
+
}
|
|
37
|
+
return this.categoryService.findById(id);
|
|
30
38
|
}
|
|
31
39
|
categories(args, language = DEFAULT_LANGUAGE) {
|
|
32
40
|
return this.categoryService.findAll({
|
|
33
41
|
...args,
|
|
34
|
-
language
|
|
42
|
+
language: this.multiLanguage ? language : null
|
|
35
43
|
});
|
|
36
44
|
}
|
|
37
45
|
backstageCategory(id) {
|
|
@@ -53,7 +61,7 @@ _ts_decorate([
|
|
|
53
61
|
String,
|
|
54
62
|
String
|
|
55
63
|
]),
|
|
56
|
-
_ts_metadata("design:returntype",
|
|
64
|
+
_ts_metadata("design:returntype", Promise)
|
|
57
65
|
], CategoryQueries.prototype, "category", null);
|
|
58
66
|
_ts_decorate([
|
|
59
67
|
Query(()=>[
|
|
@@ -71,7 +79,12 @@ _ts_decorate([
|
|
|
71
79
|
], CategoryQueries.prototype, "categories", null);
|
|
72
80
|
_ts_decorate([
|
|
73
81
|
Query(()=>BackstageCategoryDto),
|
|
74
|
-
|
|
82
|
+
AllowActions([
|
|
83
|
+
[
|
|
84
|
+
BaseResource.CATEGORY,
|
|
85
|
+
BaseAction.READ
|
|
86
|
+
]
|
|
87
|
+
]),
|
|
75
88
|
_ts_param(0, Args('id', {
|
|
76
89
|
type: ()=>ID
|
|
77
90
|
})),
|
|
@@ -85,7 +98,12 @@ _ts_decorate([
|
|
|
85
98
|
Query(()=>[
|
|
86
99
|
BackstageCategoryDto
|
|
87
100
|
]),
|
|
88
|
-
|
|
101
|
+
AllowActions([
|
|
102
|
+
[
|
|
103
|
+
BaseResource.CATEGORY,
|
|
104
|
+
BaseAction.LIST
|
|
105
|
+
]
|
|
106
|
+
]),
|
|
89
107
|
_ts_param(0, Args()),
|
|
90
108
|
_ts_metadata("design:type", Function),
|
|
91
109
|
_ts_metadata("design:paramtypes", [
|
|
@@ -95,8 +113,10 @@ _ts_decorate([
|
|
|
95
113
|
], CategoryQueries.prototype, "backstageCategories", null);
|
|
96
114
|
CategoryQueries = _ts_decorate([
|
|
97
115
|
Resolver(),
|
|
116
|
+
_ts_param(0, Inject(MULTIPLE_LANGUAGE_MODE)),
|
|
98
117
|
_ts_metadata("design:type", Function),
|
|
99
118
|
_ts_metadata("design:paramtypes", [
|
|
119
|
+
Boolean,
|
|
100
120
|
typeof CategoryBaseService === "undefined" ? Object : CategoryBaseService
|
|
101
121
|
])
|
|
102
122
|
], CategoryQueries);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolveField, Root, Resolver } from '@nestjs/graphql';
|
|
2
2
|
import { ArticleSignatureDto } from '../dto/article-signature.dto.js';
|
|
3
3
|
import { UserDto } from '../dto/user.dto.js';
|
|
4
|
-
import {
|
|
4
|
+
import { Authenticated } from '@rytass/member-base-nestjs-module';
|
|
5
5
|
import { MemberDataLoader } from '../data-loaders/members.dataloader.js';
|
|
6
6
|
import { ArticleSignatureEntity, DEFAULT_SIGNATURE_LEVEL } from '@rytass/cms-base-nestjs-module';
|
|
7
7
|
import { ArticleSignatureStepDto } from '../dto/article-signature-step.dto.js';
|
|
@@ -39,7 +39,7 @@ _ts_decorate([
|
|
|
39
39
|
ResolveField(()=>UserDto, {
|
|
40
40
|
nullable: true
|
|
41
41
|
}),
|
|
42
|
-
|
|
42
|
+
Authenticated(),
|
|
43
43
|
_ts_param(0, Root()),
|
|
44
44
|
_ts_metadata("design:type", Function),
|
|
45
45
|
_ts_metadata("design:paramtypes", [
|
|
@@ -49,7 +49,7 @@ _ts_decorate([
|
|
|
49
49
|
], ArticleSignatureResolver.prototype, "signer", null);
|
|
50
50
|
_ts_decorate([
|
|
51
51
|
ResolveField(()=>ArticleSignatureStepDto),
|
|
52
|
-
|
|
52
|
+
Authenticated(),
|
|
53
53
|
_ts_param(0, Root()),
|
|
54
54
|
_ts_metadata("design:type", Function),
|
|
55
55
|
_ts_metadata("design:paramtypes", [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolveField, ID, Root, Resolver } from '@nestjs/graphql';
|
|
2
2
|
import { MemberDataLoader } from '../data-loaders/members.dataloader.js';
|
|
3
3
|
import { UserDto } from '../dto/user.dto.js';
|
|
4
|
-
import {
|
|
4
|
+
import { Authenticated } from '@rytass/member-base-nestjs-module';
|
|
5
5
|
import { ArticleStage, MULTIPLE_LANGUAGE_MODE, ArticleVersionDataLoader, ArticleDataLoader as ArticleDataLoader$1, ArticleSignatureDataLoader, DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
6
6
|
import { CategoryDto } from '../dto/category.dto.js';
|
|
7
7
|
import { ArticleDataLoader } from '../data-loaders/article.dataloader.js';
|
|
@@ -123,7 +123,7 @@ class BackstageArticleResolver {
|
|
|
123
123
|
}
|
|
124
124
|
_ts_decorate([
|
|
125
125
|
ResolveField(()=>ID),
|
|
126
|
-
|
|
126
|
+
Authenticated(),
|
|
127
127
|
_ts_param(0, Root()),
|
|
128
128
|
_ts_metadata("design:type", Function),
|
|
129
129
|
_ts_metadata("design:paramtypes", [
|
|
@@ -133,7 +133,7 @@ _ts_decorate([
|
|
|
133
133
|
], BackstageArticleResolver.prototype, "id", null);
|
|
134
134
|
_ts_decorate([
|
|
135
135
|
ResolveField(()=>String),
|
|
136
|
-
|
|
136
|
+
Authenticated(),
|
|
137
137
|
_ts_param(0, Root()),
|
|
138
138
|
_ts_metadata("design:type", Function),
|
|
139
139
|
_ts_metadata("design:paramtypes", [
|
|
@@ -145,7 +145,7 @@ _ts_decorate([
|
|
|
145
145
|
ResolveField(()=>UserDto, {
|
|
146
146
|
nullable: true
|
|
147
147
|
}),
|
|
148
|
-
|
|
148
|
+
Authenticated(),
|
|
149
149
|
_ts_param(0, Root()),
|
|
150
150
|
_ts_metadata("design:type", Function),
|
|
151
151
|
_ts_metadata("design:paramtypes", [
|
|
@@ -157,7 +157,7 @@ _ts_decorate([
|
|
|
157
157
|
ResolveField(()=>UserDto, {
|
|
158
158
|
nullable: true
|
|
159
159
|
}),
|
|
160
|
-
|
|
160
|
+
Authenticated(),
|
|
161
161
|
_ts_param(0, Root()),
|
|
162
162
|
_ts_metadata("design:type", Function),
|
|
163
163
|
_ts_metadata("design:paramtypes", [
|
|
@@ -169,7 +169,7 @@ _ts_decorate([
|
|
|
169
169
|
ResolveField(()=>UserDto, {
|
|
170
170
|
nullable: true
|
|
171
171
|
}),
|
|
172
|
-
|
|
172
|
+
Authenticated(),
|
|
173
173
|
_ts_param(0, Root()),
|
|
174
174
|
_ts_metadata("design:type", Function),
|
|
175
175
|
_ts_metadata("design:paramtypes", [
|
|
@@ -181,7 +181,7 @@ _ts_decorate([
|
|
|
181
181
|
ResolveField(()=>[
|
|
182
182
|
CategoryDto
|
|
183
183
|
]),
|
|
184
|
-
|
|
184
|
+
Authenticated(),
|
|
185
185
|
_ts_param(0, Root()),
|
|
186
186
|
_ts_param(1, Language()),
|
|
187
187
|
_ts_metadata("design:type", Function),
|
|
@@ -193,7 +193,7 @@ _ts_decorate([
|
|
|
193
193
|
], BackstageArticleResolver.prototype, "categories", null);
|
|
194
194
|
_ts_decorate([
|
|
195
195
|
ResolveField(()=>String),
|
|
196
|
-
|
|
196
|
+
Authenticated(),
|
|
197
197
|
_ts_param(0, Root()),
|
|
198
198
|
_ts_metadata("design:type", Function),
|
|
199
199
|
_ts_metadata("design:paramtypes", [
|
|
@@ -205,7 +205,7 @@ _ts_decorate([
|
|
|
205
205
|
ResolveField(()=>String, {
|
|
206
206
|
nullable: true
|
|
207
207
|
}),
|
|
208
|
-
|
|
208
|
+
Authenticated(),
|
|
209
209
|
_ts_param(0, Root()),
|
|
210
210
|
_ts_metadata("design:type", Function),
|
|
211
211
|
_ts_metadata("design:paramtypes", [
|
|
@@ -215,7 +215,7 @@ _ts_decorate([
|
|
|
215
215
|
], BackstageArticleResolver.prototype, "description", null);
|
|
216
216
|
_ts_decorate([
|
|
217
217
|
ResolveField(()=>QuadratsContentScalar),
|
|
218
|
-
|
|
218
|
+
Authenticated(),
|
|
219
219
|
_ts_param(0, Root()),
|
|
220
220
|
_ts_metadata("design:type", Function),
|
|
221
221
|
_ts_metadata("design:paramtypes", [
|
|
@@ -227,7 +227,7 @@ _ts_decorate([
|
|
|
227
227
|
ResolveField(()=>[
|
|
228
228
|
ArticleMultiLanguageContentDto
|
|
229
229
|
]),
|
|
230
|
-
|
|
230
|
+
Authenticated(),
|
|
231
231
|
_ts_param(0, Root()),
|
|
232
232
|
_ts_metadata("design:type", Function),
|
|
233
233
|
_ts_metadata("design:paramtypes", [
|
|
@@ -239,7 +239,7 @@ _ts_decorate([
|
|
|
239
239
|
ResolveField(()=>[
|
|
240
240
|
BackstageArticleDto
|
|
241
241
|
]),
|
|
242
|
-
|
|
242
|
+
Authenticated(),
|
|
243
243
|
_ts_param(0, Root()),
|
|
244
244
|
_ts_metadata("design:type", Function),
|
|
245
245
|
_ts_metadata("design:paramtypes", [
|
|
@@ -249,7 +249,7 @@ _ts_decorate([
|
|
|
249
249
|
], BackstageArticleResolver.prototype, "versions", null);
|
|
250
250
|
_ts_decorate([
|
|
251
251
|
ResolveField(()=>ArticleStage),
|
|
252
|
-
|
|
252
|
+
Authenticated(),
|
|
253
253
|
_ts_param(0, Root()),
|
|
254
254
|
_ts_metadata("design:type", Function),
|
|
255
255
|
_ts_metadata("design:paramtypes", [
|
|
@@ -261,7 +261,7 @@ _ts_decorate([
|
|
|
261
261
|
ResolveField(()=>[
|
|
262
262
|
ArticleSignatureDto
|
|
263
263
|
]),
|
|
264
|
-
|
|
264
|
+
Authenticated(),
|
|
265
265
|
_ts_param(0, Root()),
|
|
266
266
|
_ts_metadata("design:type", Function),
|
|
267
267
|
_ts_metadata("design:paramtypes", [
|
|
@@ -271,7 +271,7 @@ _ts_decorate([
|
|
|
271
271
|
], BackstageArticleResolver.prototype, "signatures", null);
|
|
272
272
|
_ts_decorate([
|
|
273
273
|
ResolveField(()=>ArticleStageVersionDto),
|
|
274
|
-
|
|
274
|
+
Authenticated(),
|
|
275
275
|
_ts_param(0, Root()),
|
|
276
276
|
_ts_metadata("design:type", Function),
|
|
277
277
|
_ts_metadata("design:paramtypes", [
|