@rytass/cms-base-nestjs-graphql-module 0.0.2 → 0.0.4
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/cms-base-graphql.module.js +0 -6
- package/dto/article-backstage-collection.dto.d.ts +5 -0
- package/dto/article-backstage-collection.dto.js +27 -0
- package/dto/article-backstage.dto.d.ts +2 -0
- package/dto/article-backstage.dto.js +18 -7
- package/dto/article-collection.dto.d.ts +2 -2
- package/dto/article-collection.dto.js +7 -3
- package/dto/article.dto.d.ts +3 -0
- package/dto/article.dto.js +17 -7
- package/dto/articles.args.js +59 -0
- package/dto/base-article.dto.js +10 -7
- package/dto/base-category.dto.d.ts +2 -0
- package/dto/base-category.dto.js +16 -5
- package/dto/categories.args.js +43 -0
- package/dto/category.dto.d.ts +1 -0
- package/dto/category.dto.js +24 -0
- package/dto/collection.dto.js +9 -3
- package/dto/create-article.args.js +89 -0
- package/dto/create-category.args.js +61 -0
- package/dto/update-article.args.js +24 -0
- package/index.cjs.js +674 -220
- package/mutations/article.mutations.js +66 -10
- package/mutations/category.mutations.js +28 -4
- package/package.json +3 -3
- package/queries/article.queries.d.ts +7 -3
- package/queries/article.queries.js +61 -7
- package/queries/category.queries.d.ts +6 -3
- package/queries/category.queries.js +66 -8
- package/resolvers/article-backstage.resolver.d.ts +0 -5
- package/resolvers/article-backstage.resolver.js +0 -40
- package/resolvers/article.resolver.d.ts +0 -6
- package/resolvers/article.resolver.js +0 -39
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
1
|
+
import { ArticleBaseService, DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
2
2
|
import { Mutation, Args, ID, Int, Resolver } from '@nestjs/graphql';
|
|
3
3
|
import { ArticleBackstageDto } from '../dto/article-backstage.dto.js';
|
|
4
|
+
import { CreateArticleArgs } from '../dto/create-article.args.js';
|
|
4
5
|
import { IsPublic, MemberId } from '@rytass/member-base-nestjs-module';
|
|
6
|
+
import { UpdateArticleArgs } from '../dto/update-article.args.js';
|
|
5
7
|
|
|
6
8
|
function _ts_decorate(decorators, target, key, desc) {
|
|
7
9
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -9,6 +11,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
9
11
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
12
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
13
|
}
|
|
14
|
+
function _ts_metadata(k, v) {
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
16
|
+
}
|
|
12
17
|
function _ts_param(paramIndex, decorator) {
|
|
13
18
|
return function(target, key) {
|
|
14
19
|
decorator(target, key, paramIndex);
|
|
@@ -89,20 +94,37 @@ _ts_decorate([
|
|
|
89
94
|
Mutation(()=>ArticleBackstageDto),
|
|
90
95
|
IsPublic(),
|
|
91
96
|
_ts_param(0, MemberId()),
|
|
92
|
-
_ts_param(1, Args())
|
|
97
|
+
_ts_param(1, Args()),
|
|
98
|
+
_ts_metadata("design:type", Function),
|
|
99
|
+
_ts_metadata("design:paramtypes", [
|
|
100
|
+
String,
|
|
101
|
+
typeof CreateArticleArgs === "undefined" ? Object : CreateArticleArgs
|
|
102
|
+
]),
|
|
103
|
+
_ts_metadata("design:returntype", Promise)
|
|
93
104
|
], ArticleMutations.prototype, "createArticle", null);
|
|
94
105
|
_ts_decorate([
|
|
95
106
|
Mutation(()=>ArticleBackstageDto),
|
|
96
107
|
IsPublic(),
|
|
97
108
|
_ts_param(0, MemberId()),
|
|
98
|
-
_ts_param(1, Args())
|
|
109
|
+
_ts_param(1, Args()),
|
|
110
|
+
_ts_metadata("design:type", Function),
|
|
111
|
+
_ts_metadata("design:paramtypes", [
|
|
112
|
+
String,
|
|
113
|
+
typeof UpdateArticleArgs === "undefined" ? Object : UpdateArticleArgs
|
|
114
|
+
]),
|
|
115
|
+
_ts_metadata("design:returntype", Promise)
|
|
99
116
|
], ArticleMutations.prototype, "updateArticle", null);
|
|
100
117
|
_ts_decorate([
|
|
101
118
|
Mutation(()=>Boolean),
|
|
102
119
|
IsPublic(),
|
|
103
120
|
_ts_param(0, Args('id', {
|
|
104
121
|
type: ()=>ID
|
|
105
|
-
}))
|
|
122
|
+
})),
|
|
123
|
+
_ts_metadata("design:type", Function),
|
|
124
|
+
_ts_metadata("design:paramtypes", [
|
|
125
|
+
String
|
|
126
|
+
]),
|
|
127
|
+
_ts_metadata("design:returntype", Promise)
|
|
106
128
|
], ArticleMutations.prototype, "deleteArticle", null);
|
|
107
129
|
_ts_decorate([
|
|
108
130
|
Mutation(()=>ArticleBackstageDto),
|
|
@@ -113,14 +135,26 @@ _ts_decorate([
|
|
|
113
135
|
})),
|
|
114
136
|
_ts_param(2, Args('version', {
|
|
115
137
|
type: ()=>Int
|
|
116
|
-
}))
|
|
138
|
+
})),
|
|
139
|
+
_ts_metadata("design:type", Function),
|
|
140
|
+
_ts_metadata("design:paramtypes", [
|
|
141
|
+
String,
|
|
142
|
+
String,
|
|
143
|
+
Number
|
|
144
|
+
]),
|
|
145
|
+
_ts_metadata("design:returntype", Promise)
|
|
117
146
|
], ArticleMutations.prototype, "submitArticle", null);
|
|
118
147
|
_ts_decorate([
|
|
119
148
|
Mutation(()=>ArticleBackstageDto),
|
|
120
149
|
IsPublic(),
|
|
121
150
|
_ts_param(0, Args('id', {
|
|
122
151
|
type: ()=>ID
|
|
123
|
-
}))
|
|
152
|
+
})),
|
|
153
|
+
_ts_metadata("design:type", Function),
|
|
154
|
+
_ts_metadata("design:paramtypes", [
|
|
155
|
+
String
|
|
156
|
+
]),
|
|
157
|
+
_ts_metadata("design:returntype", Promise)
|
|
124
158
|
], ArticleMutations.prototype, "approveArticle", null);
|
|
125
159
|
_ts_decorate([
|
|
126
160
|
Mutation(()=>ArticleBackstageDto),
|
|
@@ -131,7 +165,13 @@ _ts_decorate([
|
|
|
131
165
|
_ts_param(1, Args('reason', {
|
|
132
166
|
type: ()=>String,
|
|
133
167
|
nullable: true
|
|
134
|
-
}))
|
|
168
|
+
})),
|
|
169
|
+
_ts_metadata("design:type", Function),
|
|
170
|
+
_ts_metadata("design:paramtypes", [
|
|
171
|
+
String,
|
|
172
|
+
Object
|
|
173
|
+
]),
|
|
174
|
+
_ts_metadata("design:returntype", Promise)
|
|
135
175
|
], ArticleMutations.prototype, "rejectArticle", null);
|
|
136
176
|
_ts_decorate([
|
|
137
177
|
Mutation(()=>ArticleBackstageDto),
|
|
@@ -142,17 +182,33 @@ _ts_decorate([
|
|
|
142
182
|
})),
|
|
143
183
|
_ts_param(2, Args('releasedAt', {
|
|
144
184
|
type: ()=>Date
|
|
145
|
-
}))
|
|
185
|
+
})),
|
|
186
|
+
_ts_metadata("design:type", Function),
|
|
187
|
+
_ts_metadata("design:paramtypes", [
|
|
188
|
+
String,
|
|
189
|
+
String,
|
|
190
|
+
typeof Date === "undefined" ? Object : Date
|
|
191
|
+
]),
|
|
192
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
146
193
|
], ArticleMutations.prototype, "releaseArticle", null);
|
|
147
194
|
_ts_decorate([
|
|
148
195
|
Mutation(()=>ArticleBackstageDto),
|
|
149
196
|
IsPublic(),
|
|
150
197
|
_ts_param(0, Args('id', {
|
|
151
198
|
type: ()=>ID
|
|
152
|
-
}))
|
|
199
|
+
})),
|
|
200
|
+
_ts_metadata("design:type", Function),
|
|
201
|
+
_ts_metadata("design:paramtypes", [
|
|
202
|
+
String
|
|
203
|
+
]),
|
|
204
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
153
205
|
], ArticleMutations.prototype, "withdrawArticle", null);
|
|
154
206
|
ArticleMutations = _ts_decorate([
|
|
155
|
-
Resolver()
|
|
207
|
+
Resolver(),
|
|
208
|
+
_ts_metadata("design:type", Function),
|
|
209
|
+
_ts_metadata("design:paramtypes", [
|
|
210
|
+
typeof ArticleBaseService === "undefined" ? Object : ArticleBaseService
|
|
211
|
+
])
|
|
156
212
|
], ArticleMutations);
|
|
157
213
|
|
|
158
214
|
export { ArticleMutations };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Mutation, Args, ID, Resolver } from '@nestjs/graphql';
|
|
2
|
+
import { CategoryBaseService } from '@rytass/cms-base-nestjs-module';
|
|
3
|
+
import { CreateCategoryArgs, UpdateCategoryArgs } from '../dto/create-category.args.js';
|
|
2
4
|
import { IsPublic } from '@rytass/member-base-nestjs-module';
|
|
3
5
|
import { CategoryBackstageDto } from '../dto/category-backstage.dto.js';
|
|
4
6
|
|
|
@@ -8,6 +10,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
8
10
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
11
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
12
|
}
|
|
13
|
+
function _ts_metadata(k, v) {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
15
|
+
}
|
|
11
16
|
function _ts_param(paramIndex, decorator) {
|
|
12
17
|
return function(target, key) {
|
|
13
18
|
decorator(target, key, paramIndex);
|
|
@@ -44,22 +49,41 @@ class CategoryMutations {
|
|
|
44
49
|
_ts_decorate([
|
|
45
50
|
Mutation(()=>CategoryBackstageDto),
|
|
46
51
|
IsPublic(),
|
|
47
|
-
_ts_param(0, Args())
|
|
52
|
+
_ts_param(0, Args()),
|
|
53
|
+
_ts_metadata("design:type", Function),
|
|
54
|
+
_ts_metadata("design:paramtypes", [
|
|
55
|
+
typeof CreateCategoryArgs === "undefined" ? Object : CreateCategoryArgs
|
|
56
|
+
]),
|
|
57
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
48
58
|
], CategoryMutations.prototype, "createCategory", null);
|
|
49
59
|
_ts_decorate([
|
|
50
60
|
Mutation(()=>CategoryBackstageDto),
|
|
51
61
|
IsPublic(),
|
|
52
|
-
_ts_param(0, Args())
|
|
62
|
+
_ts_param(0, Args()),
|
|
63
|
+
_ts_metadata("design:type", Function),
|
|
64
|
+
_ts_metadata("design:paramtypes", [
|
|
65
|
+
typeof UpdateCategoryArgs === "undefined" ? Object : UpdateCategoryArgs
|
|
66
|
+
]),
|
|
67
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
53
68
|
], CategoryMutations.prototype, "updateCategory", null);
|
|
54
69
|
_ts_decorate([
|
|
55
70
|
Mutation(()=>Boolean),
|
|
56
71
|
IsPublic(),
|
|
57
72
|
_ts_param(0, Args('id', {
|
|
58
73
|
type: ()=>ID
|
|
59
|
-
}))
|
|
74
|
+
})),
|
|
75
|
+
_ts_metadata("design:type", Function),
|
|
76
|
+
_ts_metadata("design:paramtypes", [
|
|
77
|
+
String
|
|
78
|
+
]),
|
|
79
|
+
_ts_metadata("design:returntype", Promise)
|
|
60
80
|
], CategoryMutations.prototype, "deleteCategory", null);
|
|
61
81
|
CategoryMutations = _ts_decorate([
|
|
62
|
-
Resolver()
|
|
82
|
+
Resolver(),
|
|
83
|
+
_ts_metadata("design:type", Function),
|
|
84
|
+
_ts_metadata("design:paramtypes", [
|
|
85
|
+
typeof CategoryBaseService === "undefined" ? Object : CategoryBaseService
|
|
86
|
+
])
|
|
63
87
|
], CategoryMutations);
|
|
64
88
|
|
|
65
89
|
export { 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.4",
|
|
4
4
|
"description": "Rytass Content Management System NestJS Base GraphQL Module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rytass",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"typeorm": "*"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@rytass/cms-base-nestjs-module": "^0.1.
|
|
30
|
-
"@rytass/member-base-nestjs-module": "^0.1.
|
|
29
|
+
"@rytass/cms-base-nestjs-module": "^0.1.83",
|
|
30
|
+
"@rytass/member-base-nestjs-module": "^0.1.64",
|
|
31
31
|
"dataloader": "^2.2.2",
|
|
32
32
|
"lru-cache": "^11.0.2"
|
|
33
33
|
},
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { ArticleBaseService } from '@rytass/cms-base-nestjs-module';
|
|
2
2
|
import { ArticlesArgs } from '../dto/articles.args';
|
|
3
3
|
import { ArticleCollectionDto } from '../dto/article-collection.dto';
|
|
4
|
-
import {
|
|
4
|
+
import { ArticleDto } from '../dto/article.dto';
|
|
5
|
+
import { ArticleBackstageDto } from '../dto/article-backstage.dto';
|
|
6
|
+
import { ArticleBackstageCollectionDto } from '../dto/article-backstage-collection.dto';
|
|
5
7
|
export declare class ArticleQueries {
|
|
6
8
|
private readonly articleService;
|
|
7
9
|
constructor(articleService: ArticleBaseService);
|
|
8
|
-
article(id: string, language?: string): Promise<
|
|
9
|
-
articles(args: ArticlesArgs): Promise<ArticleCollectionDto>;
|
|
10
|
+
article(id: string, language?: string): Promise<ArticleDto>;
|
|
11
|
+
articles(args: ArticlesArgs, language?: string): Promise<ArticleCollectionDto>;
|
|
12
|
+
backstageArticle(id: string): Promise<ArticleBackstageDto>;
|
|
13
|
+
backstageArticles(args: ArticlesArgs): Promise<ArticleBackstageCollectionDto>;
|
|
10
14
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Query, Args, ID, Resolver } from '@nestjs/graphql';
|
|
2
|
-
import { DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
2
|
+
import { ArticleBaseService, DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
3
|
+
import { ArticlesArgs } from '../dto/articles.args.js';
|
|
3
4
|
import { IsPublic } from '@rytass/member-base-nestjs-module';
|
|
4
5
|
import { Language } from '../decorators/language.decorator.js';
|
|
5
6
|
import { ArticleCollectionDto } from '../dto/article-collection.dto.js';
|
|
6
|
-
import {
|
|
7
|
+
import { ArticleDto } from '../dto/article.dto.js';
|
|
8
|
+
import { ArticleBackstageDto } from '../dto/article-backstage.dto.js';
|
|
9
|
+
import { ArticleBackstageCollectionDto } from '../dto/article-backstage-collection.dto.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;
|
|
@@ -11,6 +14,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
11
14
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
15
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
16
|
}
|
|
17
|
+
function _ts_metadata(k, v) {
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
19
|
+
}
|
|
14
20
|
function _ts_param(paramIndex, decorator) {
|
|
15
21
|
return function(target, key) {
|
|
16
22
|
decorator(target, key, paramIndex);
|
|
@@ -26,25 +32,73 @@ class ArticleQueries {
|
|
|
26
32
|
language: language ?? DEFAULT_LANGUAGE
|
|
27
33
|
});
|
|
28
34
|
}
|
|
29
|
-
async articles(args) {
|
|
35
|
+
async articles(args, language = DEFAULT_LANGUAGE) {
|
|
36
|
+
return this.articleService.findCollection({
|
|
37
|
+
...args,
|
|
38
|
+
language
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
backstageArticle(id) {
|
|
42
|
+
return this.articleService.findById(id);
|
|
43
|
+
}
|
|
44
|
+
backstageArticles(args) {
|
|
30
45
|
return this.articleService.findCollection(args);
|
|
31
46
|
}
|
|
32
47
|
}
|
|
33
48
|
_ts_decorate([
|
|
34
|
-
Query(()=>
|
|
49
|
+
Query(()=>ArticleDto),
|
|
35
50
|
IsPublic(),
|
|
36
51
|
_ts_param(0, Args('id', {
|
|
37
52
|
type: ()=>ID
|
|
38
53
|
})),
|
|
39
|
-
_ts_param(1, Language())
|
|
54
|
+
_ts_param(1, Language()),
|
|
55
|
+
_ts_metadata("design:type", Function),
|
|
56
|
+
_ts_metadata("design:paramtypes", [
|
|
57
|
+
String,
|
|
58
|
+
String
|
|
59
|
+
]),
|
|
60
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
40
61
|
], ArticleQueries.prototype, "article", null);
|
|
41
62
|
_ts_decorate([
|
|
42
63
|
Query(()=>ArticleCollectionDto),
|
|
43
64
|
IsPublic(),
|
|
44
|
-
_ts_param(0, Args())
|
|
65
|
+
_ts_param(0, Args()),
|
|
66
|
+
_ts_param(1, Language()),
|
|
67
|
+
_ts_metadata("design:type", Function),
|
|
68
|
+
_ts_metadata("design:paramtypes", [
|
|
69
|
+
typeof ArticlesArgs === "undefined" ? Object : ArticlesArgs,
|
|
70
|
+
String
|
|
71
|
+
]),
|
|
72
|
+
_ts_metadata("design:returntype", Promise)
|
|
45
73
|
], ArticleQueries.prototype, "articles", null);
|
|
74
|
+
_ts_decorate([
|
|
75
|
+
Query(()=>ArticleBackstageDto),
|
|
76
|
+
IsPublic(),
|
|
77
|
+
_ts_param(0, Args('id', {
|
|
78
|
+
type: ()=>ID
|
|
79
|
+
})),
|
|
80
|
+
_ts_metadata("design:type", Function),
|
|
81
|
+
_ts_metadata("design:paramtypes", [
|
|
82
|
+
String
|
|
83
|
+
]),
|
|
84
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
85
|
+
], ArticleQueries.prototype, "backstageArticle", null);
|
|
86
|
+
_ts_decorate([
|
|
87
|
+
Query(()=>ArticleBackstageCollectionDto),
|
|
88
|
+
IsPublic(),
|
|
89
|
+
_ts_param(0, Args()),
|
|
90
|
+
_ts_metadata("design:type", Function),
|
|
91
|
+
_ts_metadata("design:paramtypes", [
|
|
92
|
+
typeof ArticlesArgs === "undefined" ? Object : ArticlesArgs
|
|
93
|
+
]),
|
|
94
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
95
|
+
], ArticleQueries.prototype, "backstageArticles", null);
|
|
46
96
|
ArticleQueries = _ts_decorate([
|
|
47
|
-
Resolver()
|
|
97
|
+
Resolver(),
|
|
98
|
+
_ts_metadata("design:type", Function),
|
|
99
|
+
_ts_metadata("design:paramtypes", [
|
|
100
|
+
typeof ArticleBaseService === "undefined" ? Object : ArticleBaseService
|
|
101
|
+
])
|
|
48
102
|
], ArticleQueries);
|
|
49
103
|
|
|
50
104
|
export { ArticleQueries };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { CategoryBaseService } from '@rytass/cms-base-nestjs-module';
|
|
2
2
|
import { CategoriesArgs } from '../dto/categories.args';
|
|
3
|
-
import {
|
|
3
|
+
import { CategoryDto } from '../dto/category.dto';
|
|
4
|
+
import { CategoryBackstageDto } from '../dto/category-backstage.dto';
|
|
4
5
|
export declare class CategoryQueries {
|
|
5
6
|
private readonly categoryService;
|
|
6
7
|
constructor(categoryService: CategoryBaseService);
|
|
7
|
-
category(id: string): Promise<
|
|
8
|
-
categories(args: CategoriesArgs): Promise<
|
|
8
|
+
category(id: string, language?: string): Promise<CategoryDto>;
|
|
9
|
+
categories(args: CategoriesArgs, language?: string): Promise<CategoryDto[]>;
|
|
10
|
+
backstageCategory(id: string): Promise<CategoryBackstageDto>;
|
|
11
|
+
backstageCategories(args: CategoriesArgs): Promise<CategoryBackstageDto[]>;
|
|
9
12
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Query, Args, ID, Resolver } from '@nestjs/graphql';
|
|
2
|
+
import { CategoryBaseService, DEFAULT_LANGUAGE } from '@rytass/cms-base-nestjs-module';
|
|
3
|
+
import { CategoriesArgs } from '../dto/categories.args.js';
|
|
2
4
|
import { IsPublic } from '@rytass/member-base-nestjs-module';
|
|
3
|
-
import {
|
|
5
|
+
import { CategoryDto } from '../dto/category.dto.js';
|
|
6
|
+
import { Language } from '../decorators/language.decorator.js';
|
|
7
|
+
import { CategoryBackstageDto } from '../dto/category-backstage.dto.js';
|
|
4
8
|
|
|
5
9
|
function _ts_decorate(decorators, target, key, desc) {
|
|
6
10
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -8,6 +12,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
8
12
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
14
|
}
|
|
15
|
+
function _ts_metadata(k, v) {
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
17
|
+
}
|
|
11
18
|
function _ts_param(paramIndex, decorator) {
|
|
12
19
|
return function(target, key) {
|
|
13
20
|
decorator(target, key, paramIndex);
|
|
@@ -18,29 +25,80 @@ class CategoryQueries {
|
|
|
18
25
|
constructor(categoryService){
|
|
19
26
|
this.categoryService = categoryService;
|
|
20
27
|
}
|
|
21
|
-
category(id) {
|
|
28
|
+
category(id, language = DEFAULT_LANGUAGE) {
|
|
29
|
+
return this.categoryService.findById(id, language);
|
|
30
|
+
}
|
|
31
|
+
categories(args, language = DEFAULT_LANGUAGE) {
|
|
32
|
+
return this.categoryService.findAll({
|
|
33
|
+
...args,
|
|
34
|
+
language
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
backstageCategory(id) {
|
|
22
38
|
return this.categoryService.findById(id);
|
|
23
39
|
}
|
|
24
|
-
|
|
40
|
+
backstageCategories(args) {
|
|
25
41
|
return this.categoryService.findAll(args);
|
|
26
42
|
}
|
|
27
43
|
}
|
|
28
44
|
_ts_decorate([
|
|
29
|
-
Query(()=>
|
|
45
|
+
Query(()=>CategoryDto),
|
|
30
46
|
IsPublic(),
|
|
31
47
|
_ts_param(0, Args('id', {
|
|
32
48
|
type: ()=>ID
|
|
33
|
-
}))
|
|
49
|
+
})),
|
|
50
|
+
_ts_param(1, Language()),
|
|
51
|
+
_ts_metadata("design:type", Function),
|
|
52
|
+
_ts_metadata("design:paramtypes", [
|
|
53
|
+
String,
|
|
54
|
+
String
|
|
55
|
+
]),
|
|
56
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
34
57
|
], CategoryQueries.prototype, "category", null);
|
|
35
58
|
_ts_decorate([
|
|
36
59
|
Query(()=>[
|
|
37
|
-
|
|
60
|
+
CategoryDto
|
|
38
61
|
]),
|
|
39
62
|
IsPublic(),
|
|
40
|
-
_ts_param(0, Args())
|
|
63
|
+
_ts_param(0, Args()),
|
|
64
|
+
_ts_param(1, Language()),
|
|
65
|
+
_ts_metadata("design:type", Function),
|
|
66
|
+
_ts_metadata("design:paramtypes", [
|
|
67
|
+
typeof CategoriesArgs === "undefined" ? Object : CategoriesArgs,
|
|
68
|
+
String
|
|
69
|
+
]),
|
|
70
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
41
71
|
], CategoryQueries.prototype, "categories", null);
|
|
72
|
+
_ts_decorate([
|
|
73
|
+
Query(()=>CategoryBackstageDto),
|
|
74
|
+
IsPublic(),
|
|
75
|
+
_ts_param(0, Args('id', {
|
|
76
|
+
type: ()=>ID
|
|
77
|
+
})),
|
|
78
|
+
_ts_metadata("design:type", Function),
|
|
79
|
+
_ts_metadata("design:paramtypes", [
|
|
80
|
+
String
|
|
81
|
+
]),
|
|
82
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
83
|
+
], CategoryQueries.prototype, "backstageCategory", null);
|
|
84
|
+
_ts_decorate([
|
|
85
|
+
Query(()=>[
|
|
86
|
+
CategoryBackstageDto
|
|
87
|
+
]),
|
|
88
|
+
IsPublic(),
|
|
89
|
+
_ts_param(0, Args()),
|
|
90
|
+
_ts_metadata("design:type", Function),
|
|
91
|
+
_ts_metadata("design:paramtypes", [
|
|
92
|
+
typeof CategoriesArgs === "undefined" ? Object : CategoriesArgs
|
|
93
|
+
]),
|
|
94
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
95
|
+
], CategoryQueries.prototype, "backstageCategories", null);
|
|
42
96
|
CategoryQueries = _ts_decorate([
|
|
43
|
-
Resolver()
|
|
97
|
+
Resolver(),
|
|
98
|
+
_ts_metadata("design:type", Function),
|
|
99
|
+
_ts_metadata("design:paramtypes", [
|
|
100
|
+
typeof CategoryBaseService === "undefined" ? Object : CategoryBaseService
|
|
101
|
+
])
|
|
44
102
|
], CategoryQueries);
|
|
45
103
|
|
|
46
104
|
export { CategoryQueries };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ResolveField, Int, Root, Resolver } from '@nestjs/graphql';
|
|
2
|
-
import { ArticleBackstageDto } from '../dto/article-backstage.dto.js';
|
|
3
|
-
import { IsPublic } from '@rytass/member-base-nestjs-module';
|
|
4
|
-
|
|
5
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
}
|
|
11
|
-
function _ts_param(paramIndex, decorator) {
|
|
12
|
-
return function(target, key) {
|
|
13
|
-
decorator(target, key, paramIndex);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
class ArticleBackstageResolver {
|
|
17
|
-
version(article) {
|
|
18
|
-
return article.version;
|
|
19
|
-
}
|
|
20
|
-
deletedAt(article) {
|
|
21
|
-
return article.deletedAt ?? null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
_ts_decorate([
|
|
25
|
-
ResolveField(()=>Int),
|
|
26
|
-
IsPublic(),
|
|
27
|
-
_ts_param(0, Root())
|
|
28
|
-
], ArticleBackstageResolver.prototype, "version", null);
|
|
29
|
-
_ts_decorate([
|
|
30
|
-
ResolveField(()=>Date, {
|
|
31
|
-
nullable: true
|
|
32
|
-
}),
|
|
33
|
-
IsPublic(),
|
|
34
|
-
_ts_param(0, Root())
|
|
35
|
-
], ArticleBackstageResolver.prototype, "deletedAt", null);
|
|
36
|
-
ArticleBackstageResolver = _ts_decorate([
|
|
37
|
-
Resolver(()=>ArticleBackstageDto)
|
|
38
|
-
], ArticleBackstageResolver);
|
|
39
|
-
|
|
40
|
-
export { ArticleBackstageResolver };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SingleArticleBaseDto } from '@rytass/cms-base-nestjs-module';
|
|
2
|
-
import { QuadratsElement } from '@quadrats/core';
|
|
3
|
-
export declare class ArticleResolver {
|
|
4
|
-
title(article: SingleArticleBaseDto): string;
|
|
5
|
-
content(article: SingleArticleBaseDto): QuadratsElement[];
|
|
6
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ResolveField, Root, Resolver } from '@nestjs/graphql';
|
|
2
|
-
import { ArticleDto } from '../dto/article.dto.js';
|
|
3
|
-
import { IsPublic } from '@rytass/member-base-nestjs-module';
|
|
4
|
-
import { QuadratsContentScalar } from '../quadrats-element.scalar.js';
|
|
5
|
-
|
|
6
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
7
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
-
}
|
|
12
|
-
function _ts_param(paramIndex, decorator) {
|
|
13
|
-
return function(target, key) {
|
|
14
|
-
decorator(target, key, paramIndex);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
class ArticleResolver {
|
|
18
|
-
title(article) {
|
|
19
|
-
return article.title;
|
|
20
|
-
}
|
|
21
|
-
content(article) {
|
|
22
|
-
return article.content;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
_ts_decorate([
|
|
26
|
-
ResolveField(()=>String),
|
|
27
|
-
IsPublic(),
|
|
28
|
-
_ts_param(0, Root())
|
|
29
|
-
], ArticleResolver.prototype, "title", null);
|
|
30
|
-
_ts_decorate([
|
|
31
|
-
ResolveField(()=>QuadratsContentScalar),
|
|
32
|
-
IsPublic(),
|
|
33
|
-
_ts_param(0, Root())
|
|
34
|
-
], ArticleResolver.prototype, "content", null);
|
|
35
|
-
ArticleResolver = _ts_decorate([
|
|
36
|
-
Resolver(()=>ArticleDto)
|
|
37
|
-
], ArticleResolver);
|
|
38
|
-
|
|
39
|
-
export { ArticleResolver };
|