@things-factory/notification 6.1.84 → 6.1.87

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 (46) hide show
  1. package/dist-client/tsconfig.tsbuildinfo +1 -1
  2. package/dist-server/migrations/index.js +12 -0
  3. package/dist-server/migrations/index.js.map +1 -0
  4. package/dist-server/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +3 -3
  6. package/dist-client/pages/noti-box/noti-box-list-page.d.ts +0 -49
  7. package/dist-client/pages/noti-box/noti-box-list-page.js +0 -262
  8. package/dist-client/pages/noti-box/noti-box-list-page.js.map +0 -1
  9. package/dist-client/pages/noti-rule/noti-rule-importer.d.ts +0 -22
  10. package/dist-client/pages/noti-rule/noti-rule-importer.js +0 -100
  11. package/dist-client/pages/noti-rule/noti-rule-importer.js.map +0 -1
  12. package/dist-client/pages/noti-rule/noti-rule-list-page.d.ts +0 -62
  13. package/dist-client/pages/noti-rule/noti-rule-list-page.js +0 -380
  14. package/dist-client/pages/noti-rule/noti-rule-list-page.js.map +0 -1
  15. package/dist-server/service/noti-box/index.js +0 -9
  16. package/dist-server/service/noti-box/index.js.map +0 -1
  17. package/dist-server/service/noti-box/noti-box-mutation.js +0 -110
  18. package/dist-server/service/noti-box/noti-box-mutation.js.map +0 -1
  19. package/dist-server/service/noti-box/noti-box-query.js +0 -109
  20. package/dist-server/service/noti-box/noti-box-query.js.map +0 -1
  21. package/dist-server/service/noti-box/noti-box-type.js +0 -69
  22. package/dist-server/service/noti-box/noti-box-type.js.map +0 -1
  23. package/dist-server/service/noti-box/noti-box.js +0 -107
  24. package/dist-server/service/noti-box/noti-box.js.map +0 -1
  25. package/dist-server/service/noti-rule/event-subscriber.js +0 -21
  26. package/dist-server/service/noti-rule/event-subscriber.js.map +0 -1
  27. package/dist-server/service/noti-rule/index.js +0 -12
  28. package/dist-server/service/noti-rule/index.js.map +0 -1
  29. package/dist-server/service/noti-rule/noti-rule-history.js +0 -139
  30. package/dist-server/service/noti-rule/noti-rule-history.js.map +0 -1
  31. package/dist-server/service/noti-rule/noti-rule-mutation.js +0 -168
  32. package/dist-server/service/noti-rule/noti-rule-mutation.js.map +0 -1
  33. package/dist-server/service/noti-rule/noti-rule-query.js +0 -97
  34. package/dist-server/service/noti-rule/noti-rule-query.js.map +0 -1
  35. package/dist-server/service/noti-rule/noti-rule-type.js +0 -102
  36. package/dist-server/service/noti-rule/noti-rule-type.js.map +0 -1
  37. package/dist-server/service/noti-rule/noti-rule.js +0 -146
  38. package/dist-server/service/noti-rule/noti-rule.js.map +0 -1
  39. package/dist-server/service/notification-old/directive-notification.js +0 -59
  40. package/dist-server/service/notification-old/directive-notification.js.map +0 -1
  41. package/dist-server/service/notification-old/index.js +0 -14
  42. package/dist-server/service/notification-old/index.js.map +0 -1
  43. package/dist-server/service/notification-old/notification-resolver.js +0 -45
  44. package/dist-server/service/notification-old/notification-resolver.js.map +0 -1
  45. package/dist-server/service/notification-old/notification.js +0 -49
  46. package/dist-server/service/notification-old/notification.js.map +0 -1
@@ -1,168 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotiRuleMutation = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const typeorm_1 = require("typeorm");
7
- const attachment_base_1 = require("@things-factory/attachment-base");
8
- const noti_rule_1 = require("./noti-rule");
9
- const noti_rule_type_1 = require("./noti-rule-type");
10
- let NotiRuleMutation = class NotiRuleMutation {
11
- async createNotiRule(notiRule, context) {
12
- const { domain, user, tx } = context.state;
13
- const result = await tx.getRepository(noti_rule_1.NotiRule).save(Object.assign(Object.assign({}, notiRule), { domain, creator: user, updater: user }));
14
- if (notiRule.thumbnail) {
15
- await (0, attachment_base_1.createAttachment)(null, {
16
- attachment: {
17
- file: notiRule.thumbnail,
18
- refType: noti_rule_1.NotiRule.name,
19
- refBy: result.id
20
- }
21
- }, context);
22
- }
23
- return result;
24
- }
25
- async updateNotiRule(id, patch, context) {
26
- const { domain, user, tx } = context.state;
27
- const repository = tx.getRepository(noti_rule_1.NotiRule);
28
- const notiRule = await repository.findOne({
29
- where: { domain: { id: domain.id }, id }
30
- });
31
- const result = await repository.save(Object.assign(Object.assign(Object.assign({}, notiRule), patch), { updater: user }));
32
- if (patch.thumbnail) {
33
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [result.id] }, context);
34
- await (0, attachment_base_1.createAttachment)(null, {
35
- attachment: {
36
- file: patch.thumbnail,
37
- refType: noti_rule_1.NotiRule.name,
38
- refBy: result.id
39
- }
40
- }, context);
41
- }
42
- return result;
43
- }
44
- async updateMultipleNotiRule(patches, context) {
45
- const { domain, user, tx } = context.state;
46
- let results = [];
47
- const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
48
- const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
49
- const notiRuleRepo = tx.getRepository(noti_rule_1.NotiRule);
50
- if (_createRecords.length > 0) {
51
- for (let i = 0; i < _createRecords.length; i++) {
52
- const newRecord = _createRecords[i];
53
- const result = await notiRuleRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
54
- if (newRecord.thumbnail) {
55
- await (0, attachment_base_1.createAttachment)(null, {
56
- attachment: {
57
- file: newRecord.thumbnail,
58
- refType: noti_rule_1.NotiRule.name,
59
- refBy: result.id
60
- }
61
- }, context);
62
- }
63
- results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
64
- }
65
- }
66
- if (_updateRecords.length > 0) {
67
- for (let i = 0; i < _updateRecords.length; i++) {
68
- const updateRecord = _updateRecords[i];
69
- const notiRule = await notiRuleRepo.findOneBy({ id: updateRecord.id });
70
- const result = await notiRuleRepo.save(Object.assign(Object.assign(Object.assign({}, notiRule), updateRecord), { updater: user }));
71
- if (updateRecord.thumbnail) {
72
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [result.id] }, context);
73
- await (0, attachment_base_1.createAttachment)(null, {
74
- attachment: {
75
- file: updateRecord.thumbnail,
76
- refType: noti_rule_1.NotiRule.name,
77
- refBy: result.id
78
- }
79
- }, context);
80
- }
81
- results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
82
- }
83
- }
84
- return results;
85
- }
86
- async deleteNotiRule(id, context) {
87
- const { domain, tx } = context.state;
88
- await tx.getRepository(noti_rule_1.NotiRule).delete({ domain: { id: domain.id }, id });
89
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
90
- return true;
91
- }
92
- async deleteNotiRules(ids, context) {
93
- const { domain, tx } = context.state;
94
- await tx.getRepository(noti_rule_1.NotiRule).delete({
95
- domain: { id: domain.id },
96
- id: (0, typeorm_1.In)(ids)
97
- });
98
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
99
- return true;
100
- }
101
- async importNotiRules(notiRules, context) {
102
- const { domain, tx } = context.state;
103
- await Promise.all(notiRules.map(async (notiRule) => {
104
- const createdNotiRule = await tx.getRepository(noti_rule_1.NotiRule).save(Object.assign({ domain }, notiRule));
105
- }));
106
- return true;
107
- }
108
- };
109
- tslib_1.__decorate([
110
- (0, type_graphql_1.Directive)('@transaction'),
111
- (0, type_graphql_1.Mutation)(returns => noti_rule_1.NotiRule, { description: 'To create new NotiRule' }),
112
- tslib_1.__param(0, (0, type_graphql_1.Arg)('notiRule')),
113
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
114
- tslib_1.__metadata("design:type", Function),
115
- tslib_1.__metadata("design:paramtypes", [noti_rule_type_1.NewNotiRule, Object]),
116
- tslib_1.__metadata("design:returntype", Promise)
117
- ], NotiRuleMutation.prototype, "createNotiRule", null);
118
- tslib_1.__decorate([
119
- (0, type_graphql_1.Directive)('@transaction'),
120
- (0, type_graphql_1.Mutation)(returns => noti_rule_1.NotiRule, { description: 'To modify NotiRule information' }),
121
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
122
- tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
123
- tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
124
- tslib_1.__metadata("design:type", Function),
125
- tslib_1.__metadata("design:paramtypes", [String, noti_rule_type_1.NotiRulePatch, Object]),
126
- tslib_1.__metadata("design:returntype", Promise)
127
- ], NotiRuleMutation.prototype, "updateNotiRule", null);
128
- tslib_1.__decorate([
129
- (0, type_graphql_1.Directive)('@transaction'),
130
- (0, type_graphql_1.Mutation)(returns => [noti_rule_1.NotiRule], { description: "To modify multiple NotiRules' information" }),
131
- tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [noti_rule_type_1.NotiRulePatch])),
132
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
133
- tslib_1.__metadata("design:type", Function),
134
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
135
- tslib_1.__metadata("design:returntype", Promise)
136
- ], NotiRuleMutation.prototype, "updateMultipleNotiRule", null);
137
- tslib_1.__decorate([
138
- (0, type_graphql_1.Directive)('@transaction'),
139
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete NotiRule' }),
140
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
141
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
142
- tslib_1.__metadata("design:type", Function),
143
- tslib_1.__metadata("design:paramtypes", [String, Object]),
144
- tslib_1.__metadata("design:returntype", Promise)
145
- ], NotiRuleMutation.prototype, "deleteNotiRule", null);
146
- tslib_1.__decorate([
147
- (0, type_graphql_1.Directive)('@transaction'),
148
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple NotiRules' }),
149
- tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
150
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
151
- tslib_1.__metadata("design:type", Function),
152
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
153
- tslib_1.__metadata("design:returntype", Promise)
154
- ], NotiRuleMutation.prototype, "deleteNotiRules", null);
155
- tslib_1.__decorate([
156
- (0, type_graphql_1.Directive)('@transaction'),
157
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple NotiRules' }),
158
- tslib_1.__param(0, (0, type_graphql_1.Arg)('notiRules', type => [noti_rule_type_1.NotiRulePatch])),
159
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
160
- tslib_1.__metadata("design:type", Function),
161
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
162
- tslib_1.__metadata("design:returntype", Promise)
163
- ], NotiRuleMutation.prototype, "importNotiRules", null);
164
- NotiRuleMutation = tslib_1.__decorate([
165
- (0, type_graphql_1.Resolver)(noti_rule_1.NotiRule)
166
- ], NotiRuleMutation);
167
- exports.NotiRuleMutation = NotiRuleMutation;
168
- //# sourceMappingURL=noti-rule-mutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noti-rule-mutation.js","sourceRoot":"","sources":["../../../server/service/noti-rule/noti-rule-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,2CAAsC;AACtC,qDAA6D;AAGtD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,oBAAQ,CAAC,CAAC,IAAI,iCAC/C,QAAQ,KACX,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,IAAI,QAAQ,CAAC,SAAS,EAAE;YACtB,MAAM,IAAA,kCAAgB,EACpB,IAAI,EACJ;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ,CAAC,SAAS;oBACxB,OAAO,EAAE,oBAAQ,CAAC,IAAI;oBACtB,KAAK,EAAE,MA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,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,gBAAgB,CA4L5B;AA5LY,4CAAgB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { NotiRule } from './noti-rule'\nimport { NewNotiRule, NotiRulePatch } from './noti-rule-type'\n\n@Resolver(NotiRule)\nexport class NotiRuleMutation {\n @Directive('@transaction')\n @Mutation(returns => NotiRule, { description: 'To create new NotiRule' })\n async createNotiRule(@Arg('notiRule') notiRule: NewNotiRule, @Ctx() context: ResolverContext): Promise<NotiRule> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(NotiRule).save({\n ...notiRule,\n domain,\n creator: user,\n updater: user\n })\n\n if (notiRule.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: notiRule.thumbnail,\n refType: NotiRule.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => NotiRule, { description: 'To modify NotiRule information' })\n async updateNotiRule(\n @Arg('id') id: string,\n @Arg('patch') patch: NotiRulePatch,\n @Ctx() context: ResolverContext\n ): Promise<NotiRule> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(NotiRule)\n const notiRule = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...notiRule,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: NotiRule.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [NotiRule], { description: \"To modify multiple NotiRules' information\" })\n async updateMultipleNotiRule(\n @Arg('patches', type => [NotiRulePatch]) patches: NotiRulePatch[],\n @Ctx() context: ResolverContext\n ): Promise<NotiRule[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const notiRuleRepo = tx.getRepository(NotiRule)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await notiRuleRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: NotiRule.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const notiRule = await notiRuleRepo.findOneBy({ id: updateRecord.id })\n\n const result = await notiRuleRepo.save({\n ...notiRule,\n ...updateRecord,\n updater: user\n })\n\n if (updateRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.thumbnail,\n refType: NotiRule.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete NotiRule' })\n async deleteNotiRule(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(NotiRule).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple NotiRules' })\n async deleteNotiRules(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(NotiRule).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple NotiRules' })\n async importNotiRules(\n @Arg('notiRules', type => [NotiRulePatch]) notiRules: NotiRulePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n notiRules.map(async (notiRule: NotiRulePatch) => {\n const createdNotiRule: NotiRule = await tx.getRepository(NotiRule).save({ domain, ...notiRule })\n })\n )\n\n return true\n }\n}\n"]}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotiRuleQuery = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const attachment_base_1 = require("@things-factory/attachment-base");
7
- const shell_1 = require("@things-factory/shell");
8
- const auth_base_1 = require("@things-factory/auth-base");
9
- const noti_rule_1 = require("./noti-rule");
10
- const noti_rule_type_1 = require("./noti-rule-type");
11
- let NotiRuleQuery = class NotiRuleQuery {
12
- async notiRule(id, context) {
13
- const { domain } = context.state;
14
- return await (0, shell_1.getRepository)(noti_rule_1.NotiRule).findOne({
15
- where: { domain: { id: domain.id }, id }
16
- });
17
- }
18
- async notiRules(params, context) {
19
- const { domain } = context.state;
20
- const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
21
- domain,
22
- params,
23
- repository: await (0, shell_1.getRepository)(noti_rule_1.NotiRule),
24
- searchables: ['name', 'description']
25
- });
26
- const [items, total] = await queryBuilder.getManyAndCount();
27
- return { items, total };
28
- }
29
- async thumbnail(notiRule) {
30
- const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
31
- where: {
32
- domain: { id: notiRule.domainId },
33
- refType: noti_rule_1.NotiRule.name,
34
- refBy: notiRule.id
35
- }
36
- });
37
- return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
38
- }
39
- async domain(notiRule) {
40
- return notiRule.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: notiRule.domainId }));
41
- }
42
- async updater(notiRule) {
43
- return notiRule.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: notiRule.updaterId }));
44
- }
45
- async creator(notiRule) {
46
- return notiRule.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: notiRule.creatorId }));
47
- }
48
- };
49
- tslib_1.__decorate([
50
- (0, type_graphql_1.Query)(returns => noti_rule_1.NotiRule, { nullable: true, description: 'To fetch a NotiRule' }),
51
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
52
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
53
- tslib_1.__metadata("design:type", Function),
54
- tslib_1.__metadata("design:paramtypes", [String, Object]),
55
- tslib_1.__metadata("design:returntype", Promise)
56
- ], NotiRuleQuery.prototype, "notiRule", null);
57
- tslib_1.__decorate([
58
- (0, type_graphql_1.Query)(returns => noti_rule_type_1.NotiRuleList, { description: 'To fetch multiple NotiRules' }),
59
- tslib_1.__param(0, (0, type_graphql_1.Args)()),
60
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
61
- tslib_1.__metadata("design:type", Function),
62
- tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
63
- tslib_1.__metadata("design:returntype", Promise)
64
- ], NotiRuleQuery.prototype, "notiRules", null);
65
- tslib_1.__decorate([
66
- (0, type_graphql_1.FieldResolver)(type => String),
67
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
68
- tslib_1.__metadata("design:type", Function),
69
- tslib_1.__metadata("design:paramtypes", [noti_rule_1.NotiRule]),
70
- tslib_1.__metadata("design:returntype", Promise)
71
- ], NotiRuleQuery.prototype, "thumbnail", null);
72
- tslib_1.__decorate([
73
- (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
74
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
75
- tslib_1.__metadata("design:type", Function),
76
- tslib_1.__metadata("design:paramtypes", [noti_rule_1.NotiRule]),
77
- tslib_1.__metadata("design:returntype", Promise)
78
- ], NotiRuleQuery.prototype, "domain", null);
79
- tslib_1.__decorate([
80
- (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
81
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
82
- tslib_1.__metadata("design:type", Function),
83
- tslib_1.__metadata("design:paramtypes", [noti_rule_1.NotiRule]),
84
- tslib_1.__metadata("design:returntype", Promise)
85
- ], NotiRuleQuery.prototype, "updater", null);
86
- tslib_1.__decorate([
87
- (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
88
- tslib_1.__param(0, (0, type_graphql_1.Root)()),
89
- tslib_1.__metadata("design:type", Function),
90
- tslib_1.__metadata("design:paramtypes", [noti_rule_1.NotiRule]),
91
- tslib_1.__metadata("design:returntype", Promise)
92
- ], NotiRuleQuery.prototype, "creator", null);
93
- NotiRuleQuery = tslib_1.__decorate([
94
- (0, type_graphql_1.Resolver)(noti_rule_1.NotiRule)
95
- ], NotiRuleQuery);
96
- exports.NotiRuleQuery = NotiRuleQuery;
97
- //# sourceMappingURL=noti-rule-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noti-rule-query.js","sourceRoot":"","sources":["../../../server/service/noti-rule/noti-rule-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,2CAAsC;AACtC,qDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAElB,AAAN,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAwB;QACnE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,oBAAQ,CAAC,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAA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,CAAA;;6CAAW,oBAAQ;;4CAEvC;AApDU,aAAa;IADzB,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,aAAa,CAqDzB;AArDY,sCAAa","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { NotiRule } from './noti-rule'\nimport { NotiRuleList } from './noti-rule-type'\n\n@Resolver(NotiRule)\nexport class NotiRuleQuery {\n @Query(returns => NotiRule!, { nullable: true, description: 'To fetch a NotiRule' })\n async notiRule(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<NotiRule> {\n const { domain } = context.state\n\n return await getRepository(NotiRule).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => NotiRuleList, { description: 'To fetch multiple NotiRules' })\n async notiRules(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<NotiRuleList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(NotiRule),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() notiRule: NotiRule): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: notiRule.domainId },\n refType: NotiRule.name,\n refBy: notiRule.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() notiRule: NotiRule): Promise<Domain> {\n return notiRule.domainId && (await getRepository(Domain).findOneBy({ id: notiRule.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() notiRule: NotiRule): Promise<User> {\n return notiRule.updaterId && (await getRepository(User).findOneBy({ id: notiRule.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() notiRule: NotiRule): Promise<User> {\n return notiRule.creatorId && (await getRepository(User).findOneBy({ id: notiRule.creatorId }))\n }\n}\n"]}
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotiRuleList = exports.NotiRulePatch = exports.NewNotiRule = void 0;
4
- const tslib_1 = require("tslib");
5
- const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
6
- const type_graphql_1 = require("type-graphql");
7
- const noti_rule_1 = require("./noti-rule");
8
- let NewNotiRule = class NewNotiRule {
9
- };
10
- tslib_1.__decorate([
11
- (0, type_graphql_1.Field)(),
12
- tslib_1.__metadata("design:type", String)
13
- ], NewNotiRule.prototype, "name", void 0);
14
- tslib_1.__decorate([
15
- (0, type_graphql_1.Field)({ nullable: true }),
16
- tslib_1.__metadata("design:type", String)
17
- ], NewNotiRule.prototype, "description", void 0);
18
- tslib_1.__decorate([
19
- (0, type_graphql_1.Field)(type => noti_rule_1.NotiRuleStatus, { nullable: true }),
20
- tslib_1.__metadata("design:type", String)
21
- ], NewNotiRule.prototype, "state", void 0);
22
- tslib_1.__decorate([
23
- (0, type_graphql_1.Field)({ nullable: true }),
24
- tslib_1.__metadata("design:type", Boolean)
25
- ], NewNotiRule.prototype, "active", void 0);
26
- tslib_1.__decorate([
27
- (0, type_graphql_1.Field)({ nullable: true }),
28
- tslib_1.__metadata("design:type", String)
29
- ], NewNotiRule.prototype, "title", void 0);
30
- tslib_1.__decorate([
31
- (0, type_graphql_1.Field)({ nullable: true }),
32
- tslib_1.__metadata("design:type", String)
33
- ], NewNotiRule.prototype, "body", void 0);
34
- tslib_1.__decorate([
35
- (0, type_graphql_1.Field)({ nullable: true }),
36
- tslib_1.__metadata("design:type", String)
37
- ], NewNotiRule.prototype, "url", void 0);
38
- tslib_1.__decorate([
39
- (0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
40
- tslib_1.__metadata("design:type", Object)
41
- ], NewNotiRule.prototype, "thumbnail", void 0);
42
- NewNotiRule = tslib_1.__decorate([
43
- (0, type_graphql_1.InputType)()
44
- ], NewNotiRule);
45
- exports.NewNotiRule = NewNotiRule;
46
- let NotiRulePatch = class NotiRulePatch {
47
- };
48
- tslib_1.__decorate([
49
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
50
- tslib_1.__metadata("design:type", String)
51
- ], NotiRulePatch.prototype, "id", void 0);
52
- tslib_1.__decorate([
53
- (0, type_graphql_1.Field)({ nullable: true }),
54
- tslib_1.__metadata("design:type", String)
55
- ], NotiRulePatch.prototype, "name", void 0);
56
- tslib_1.__decorate([
57
- (0, type_graphql_1.Field)({ nullable: true }),
58
- tslib_1.__metadata("design:type", String)
59
- ], NotiRulePatch.prototype, "description", void 0);
60
- tslib_1.__decorate([
61
- (0, type_graphql_1.Field)(type => noti_rule_1.NotiRuleStatus, { nullable: true }),
62
- tslib_1.__metadata("design:type", String)
63
- ], NotiRulePatch.prototype, "state", void 0);
64
- tslib_1.__decorate([
65
- (0, type_graphql_1.Field)({ nullable: true }),
66
- tslib_1.__metadata("design:type", String)
67
- ], NotiRulePatch.prototype, "title", void 0);
68
- tslib_1.__decorate([
69
- (0, type_graphql_1.Field)({ nullable: true }),
70
- tslib_1.__metadata("design:type", String)
71
- ], NotiRulePatch.prototype, "body", void 0);
72
- tslib_1.__decorate([
73
- (0, type_graphql_1.Field)({ nullable: true }),
74
- tslib_1.__metadata("design:type", String)
75
- ], NotiRulePatch.prototype, "url", void 0);
76
- tslib_1.__decorate([
77
- (0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
78
- tslib_1.__metadata("design:type", Object)
79
- ], NotiRulePatch.prototype, "thumbnail", void 0);
80
- tslib_1.__decorate([
81
- (0, type_graphql_1.Field)({ nullable: true }),
82
- tslib_1.__metadata("design:type", String)
83
- ], NotiRulePatch.prototype, "cuFlag", void 0);
84
- NotiRulePatch = tslib_1.__decorate([
85
- (0, type_graphql_1.InputType)()
86
- ], NotiRulePatch);
87
- exports.NotiRulePatch = NotiRulePatch;
88
- let NotiRuleList = class NotiRuleList {
89
- };
90
- tslib_1.__decorate([
91
- (0, type_graphql_1.Field)(type => [noti_rule_1.NotiRule]),
92
- tslib_1.__metadata("design:type", Array)
93
- ], NotiRuleList.prototype, "items", void 0);
94
- tslib_1.__decorate([
95
- (0, type_graphql_1.Field)(type => type_graphql_1.Int),
96
- tslib_1.__metadata("design:type", Number)
97
- ], NotiRuleList.prototype, "total", void 0);
98
- NotiRuleList = tslib_1.__decorate([
99
- (0, type_graphql_1.ObjectType)()
100
- ], NotiRuleList);
101
- exports.NotiRuleList = NotiRuleList;
102
- //# sourceMappingURL=noti-rule-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noti-rule-type.js","sourceRoot":"","sources":["../../../server/service/noti-rule/noti-rule-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAoE;AAEpE,2CAAsD;AAG/C,IAAM,WAAW,GAAjB,MAAM,WAAW;CAwBvB,CAAA;AAvBC;IAAC,IAAA,oBAAK,GAAE;;yCACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC5B;AAEtB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACd;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACf;AAEX;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC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C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;2CACN;AALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB;AANY,oCAAY","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { NotiRule, NotiRuleStatus } from './noti-rule'\n\n@InputType()\nexport class NewNotiRule {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => NotiRuleStatus, { nullable: true })\n state?: NotiRuleStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n title: string\n\n @Field({ nullable: true })\n body: string\n\n @Field({ nullable: true })\n url: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n}\n\n@InputType()\nexport class NotiRulePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => NotiRuleStatus, { nullable: true })\n state?: NotiRuleStatus\n\n @Field({ nullable: true })\n title: string\n\n @Field({ nullable: true })\n body: string\n\n @Field({ nullable: true })\n url: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class NotiRuleList {\n @Field(type => [NotiRule])\n items: NotiRule[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -1,146 +0,0 @@
1
- "use strict";
2
- var _a, _b;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.NotiRule = exports.RecipientItem = exports.NotiRuleStatus = void 0;
5
- const tslib_1 = require("tslib");
6
- const typeorm_1 = require("typeorm");
7
- const type_graphql_1 = require("type-graphql");
8
- const shell_1 = require("@things-factory/shell");
9
- const auth_base_1 = require("@things-factory/auth-base");
10
- const organization_1 = require("@things-factory/organization");
11
- var NotiRuleStatus;
12
- (function (NotiRuleStatus) {
13
- NotiRuleStatus["DRAFT"] = "DRAFT";
14
- NotiRuleStatus["RELEASED"] = "RELEASED";
15
- })(NotiRuleStatus = exports.NotiRuleStatus || (exports.NotiRuleStatus = {}));
16
- (0, type_graphql_1.registerEnumType)(NotiRuleStatus, {
17
- name: 'NotiRuleStatus',
18
- description: 'state enumeration of a notiRule'
19
- });
20
- let RecipientItem = class RecipientItem {
21
- };
22
- tslib_1.__decorate([
23
- (0, type_graphql_1.Field)(type => organization_1.OrgMemberTargetType, { nullable: true }),
24
- tslib_1.__metadata("design:type", typeof (_a = typeof organization_1.OrgMemberTargetType !== "undefined" && organization_1.OrgMemberTargetType) === "function" ? _a : Object)
25
- ], RecipientItem.prototype, "type", void 0);
26
- tslib_1.__decorate([
27
- (0, type_graphql_1.Field)({ nullable: true }),
28
- tslib_1.__metadata("design:type", String)
29
- ], RecipientItem.prototype, "value", void 0);
30
- tslib_1.__decorate([
31
- (0, type_graphql_1.Field)(type => organization_1.OrgMemberTarget, { nullable: true }),
32
- tslib_1.__metadata("design:type", typeof (_b = typeof organization_1.OrgMemberTarget !== "undefined" && organization_1.OrgMemberTarget) === "function" ? _b : Object)
33
- ], RecipientItem.prototype, "recipient", void 0);
34
- RecipientItem = tslib_1.__decorate([
35
- (0, type_graphql_1.ObjectType)()
36
- ], RecipientItem);
37
- exports.RecipientItem = RecipientItem;
38
- let NotiRule = class NotiRule {
39
- constructor() {
40
- this.version = 1;
41
- }
42
- };
43
- tslib_1.__decorate([
44
- (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
45
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
46
- tslib_1.__metadata("design:type", String)
47
- ], NotiRule.prototype, "id", void 0);
48
- tslib_1.__decorate([
49
- (0, typeorm_1.VersionColumn)(),
50
- (0, type_graphql_1.Field)({ nullable: true }),
51
- tslib_1.__metadata("design:type", Number)
52
- ], NotiRule.prototype, "version", void 0);
53
- tslib_1.__decorate([
54
- (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
55
- (0, type_graphql_1.Field)({ nullable: true }),
56
- tslib_1.__metadata("design:type", shell_1.Domain)
57
- ], NotiRule.prototype, "domain", void 0);
58
- tslib_1.__decorate([
59
- (0, typeorm_1.RelationId)((notiRule) => notiRule.domain),
60
- tslib_1.__metadata("design:type", String)
61
- ], NotiRule.prototype, "domainId", void 0);
62
- tslib_1.__decorate([
63
- (0, typeorm_1.Column)(),
64
- (0, type_graphql_1.Field)({ nullable: true }),
65
- tslib_1.__metadata("design:type", String)
66
- ], NotiRule.prototype, "name", void 0);
67
- tslib_1.__decorate([
68
- (0, typeorm_1.Column)({ nullable: true }),
69
- (0, type_graphql_1.Field)({ nullable: true }),
70
- tslib_1.__metadata("design:type", String)
71
- ], NotiRule.prototype, "description", void 0);
72
- tslib_1.__decorate([
73
- (0, typeorm_1.Column)({ nullable: true }),
74
- (0, type_graphql_1.Field)({ nullable: true }),
75
- tslib_1.__metadata("design:type", String)
76
- ], NotiRule.prototype, "state", void 0);
77
- tslib_1.__decorate([
78
- (0, typeorm_1.Column)({ nullable: true }),
79
- (0, type_graphql_1.Field)({ nullable: true }),
80
- tslib_1.__metadata("design:type", String)
81
- ], NotiRule.prototype, "title", void 0);
82
- tslib_1.__decorate([
83
- (0, typeorm_1.Column)({ nullable: true }),
84
- (0, type_graphql_1.Field)({ nullable: true }),
85
- tslib_1.__metadata("design:type", String)
86
- ], NotiRule.prototype, "body", void 0);
87
- tslib_1.__decorate([
88
- (0, typeorm_1.Column)({ nullable: true }),
89
- (0, type_graphql_1.Field)({ nullable: true }),
90
- tslib_1.__metadata("design:type", String)
91
- ], NotiRule.prototype, "url", void 0);
92
- tslib_1.__decorate([
93
- (0, typeorm_1.Column)({ nullable: true }),
94
- (0, type_graphql_1.Field)({ nullable: true }),
95
- tslib_1.__metadata("design:type", String)
96
- ], NotiRule.prototype, "thumbnail", void 0);
97
- tslib_1.__decorate([
98
- (0, typeorm_1.Column)({ nullable: true }),
99
- (0, type_graphql_1.Field)({ nullable: true }),
100
- tslib_1.__metadata("design:type", String)
101
- ], NotiRule.prototype, "channels", void 0);
102
- tslib_1.__decorate([
103
- (0, typeorm_1.Column)('simple-json', { nullable: true }),
104
- (0, type_graphql_1.Field)(type => [RecipientItem], { nullable: true, description: 'notification recipients.' }),
105
- tslib_1.__metadata("design:type", String)
106
- ], NotiRule.prototype, "recipients", void 0);
107
- tslib_1.__decorate([
108
- (0, typeorm_1.CreateDateColumn)(),
109
- (0, type_graphql_1.Field)({ nullable: true }),
110
- tslib_1.__metadata("design:type", Date)
111
- ], NotiRule.prototype, "createdAt", void 0);
112
- tslib_1.__decorate([
113
- (0, typeorm_1.UpdateDateColumn)(),
114
- (0, type_graphql_1.Field)({ nullable: true }),
115
- tslib_1.__metadata("design:type", Date)
116
- ], NotiRule.prototype, "updatedAt", void 0);
117
- tslib_1.__decorate([
118
- (0, typeorm_1.DeleteDateColumn)(),
119
- (0, type_graphql_1.Field)({ nullable: true }),
120
- tslib_1.__metadata("design:type", Date)
121
- ], NotiRule.prototype, "deletedAt", void 0);
122
- tslib_1.__decorate([
123
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
124
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
125
- tslib_1.__metadata("design:type", auth_base_1.User)
126
- ], NotiRule.prototype, "creator", void 0);
127
- tslib_1.__decorate([
128
- (0, typeorm_1.RelationId)((notiRule) => notiRule.creator),
129
- tslib_1.__metadata("design:type", String)
130
- ], NotiRule.prototype, "creatorId", void 0);
131
- tslib_1.__decorate([
132
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
133
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
134
- tslib_1.__metadata("design:type", auth_base_1.User)
135
- ], NotiRule.prototype, "updater", void 0);
136
- tslib_1.__decorate([
137
- (0, typeorm_1.RelationId)((notiRule) => notiRule.updater),
138
- tslib_1.__metadata("design:type", String)
139
- ], NotiRule.prototype, "updaterId", void 0);
140
- NotiRule = tslib_1.__decorate([
141
- (0, typeorm_1.Entity)(),
142
- (0, typeorm_1.Index)('ix_noti_rule_0', (notiRule) => [notiRule.domain, notiRule.name, notiRule.deletedAt], { unique: true }),
143
- (0, type_graphql_1.ObjectType)({ description: 'Entity for NotiRule' })
144
- ], NotiRule);
145
- exports.NotiRule = NotiRule;
146
- //# sourceMappingURL=noti-rule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"noti-rule.js","sourceRoot":"","sources":["../../../server/service/noti-rule/noti-rule.ts"],"names":[],"mappings":";;;;;AAAA,qCAWgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAChD,+DAAmF;AAEnF,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,uCAAqB,CAAA;AACvB,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAED,IAAA,+BAAgB,EAAC,cAAc,EAAE;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iCAAiC;CAC/C,CAAC,CAAA;AAGK,IAAM,aAAa,GAAnB,MAAM,aAAa;CASzB,CAAA;AARC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;0DAChD,kCAAmB,oBAAnB,kCAAmB;2CAAA;AAE1B;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACZ;AAEd;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,8BAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;0DACvC,8BAAe,oBAAf,8BAAe;gDAAA;AARhB,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CASzB;AATY,sCAAa;AAcnB,IAAM,QAAQ,GAAd,MAAM,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AkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;AAElB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;yCAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;2CACnC;AA5EP,QAAQ;IAHpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CA6EpB;AA7EY,4BAAQ","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n PrimaryGeneratedColumn,\n VersionColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { OrgMemberTargetType, OrgMemberTarget } from '@things-factory/organization'\n\nexport enum NotiRuleStatus {\n DRAFT = 'DRAFT',\n RELEASED = 'RELEASED'\n}\n\nregisterEnumType(NotiRuleStatus, {\n name: 'NotiRuleStatus',\n description: 'state enumeration of a notiRule'\n})\n\n@ObjectType()\nexport class RecipientItem {\n @Field(type => OrgMemberTargetType, { nullable: true })\n type?: OrgMemberTargetType\n\n @Field({ nullable: true })\n value?: string\n\n @Field(type => OrgMemberTarget, { nullable: true })\n recipient?: OrgMemberTarget\n}\n\n@Entity()\n@Index('ix_noti_rule_0', (notiRule: NotiRule) => [notiRule.domain, notiRule.name, notiRule.deletedAt], { unique: true })\n@ObjectType({ description: 'Entity for NotiRule' })\nexport class NotiRule {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @VersionColumn()\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((notiRule: NotiRule) => notiRule.domain)\n domainId?: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: NotiRuleStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n title: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n body: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n url: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n thumbnail: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n channels: string\n\n @Column('simple-json', { nullable: true })\n @Field(type => [RecipientItem], { nullable: true, description: 'notification recipients.' })\n recipients: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((notiRule: NotiRule) => notiRule.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((notiRule: NotiRule) => notiRule.updater)\n updaterId?: string\n}\n"]}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.directiveNotification = exports.notificationDirectiveTypeDefs = void 0;
4
- const tslib_1 = require("tslib");
5
- const graphql_1 = require("graphql");
6
- const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
7
- const utils_1 = require("@graphql-tools/utils");
8
- const debug = require('debug')('things-factory:notification:directive-notification');
9
- const DIRECTIVE = 'notification';
10
- exports.notificationDirectiveTypeDefs = (0, graphql_tag_1.default) `
11
- directive @notification(
12
- receivers: String
13
- topic: String
14
- subject: String # info
15
- title: String
16
- body: String
17
- image: String
18
- url: String
19
- # timestamp = String(Date.now())
20
- mode: String # background
21
- ) on FIELD_DEFINITION
22
- `;
23
- const directiveNotification = (schema) => (0, utils_1.mapSchema)(schema, {
24
- [utils_1.MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName, schema) => {
25
- var _a;
26
- const notificationDirective = (_a = (0, utils_1.getDirective)(schema, fieldConfig, DIRECTIVE)) === null || _a === void 0 ? void 0 : _a[0];
27
- if (notificationDirective) {
28
- const { resolve = graphql_1.defaultFieldResolver, args } = fieldConfig;
29
- if (!args) {
30
- throw new Error(`Unexpected Error. args should be defined in @notification directive for field ${fieldName}.`);
31
- }
32
- const { receivers, topic, subject = 'info', title, body, image, url, mode = 'background' } = notificationDirective;
33
- const timestamp = Date.now();
34
- fieldConfig.resolve = async function (source, args, context, info) {
35
- const result = await resolve.call(this, source, args, context, info);
36
- const { domain, user, notify } = context.state;
37
- if (!notify) {
38
- debug('notify not set');
39
- }
40
- else {
41
- try {
42
- await notify({
43
- receivers: [user.id],
44
- notificationDirective,
45
- timestamp: new Date()
46
- });
47
- }
48
- catch (err) {
49
- debug(err);
50
- }
51
- }
52
- return result;
53
- };
54
- return fieldConfig;
55
- }
56
- }
57
- });
58
- exports.directiveNotification = directiveNotification;
59
- //# sourceMappingURL=directive-notification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directive-notification.js","sourceRoot":"","sources":["../../../server/service/notification-old/directive-notification.ts"],"names":[],"mappings":";;;;AAAA,qCAA6D;AAC7D,sEAA6B;AAE7B,gDAA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E;oBACX,KAAK,CAAC,gBAAgB,CAAC,CAAA;iBACxB;qBAAM;oBACL,IAAI;wBACF,MAAM,MAAM,CAAC;4BACX,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;4BACpB,qBAAqB;4BACrB,SAAS,EAAE,IAAI,IAAI,EAAE;yBACtB,CAAC,CAAA;qBACH;oBAAC,OAAO,GAAG,EAAE;wBACZ,KAAK,CAAC,GAAG,CAAC,CAAA;qBACX;iBACF;gBAED,OAAO,MAAM,CAAA;YACf,CAAC,CAAA;YAED,OAAO,WAAW,CAAA;SACnB;IACH,CAAC;CACF,CAAC,CAAA;AAhDS,QAAA,qBAAqB,yBAgD9B","sourcesContent":["import { defaultFieldResolver, GraphQLSchema } from 'graphql'\nimport gql from 'graphql-tag'\n\nimport { getDirective, MapperKind, mapSchema } from '@graphql-tools/utils'\n\nconst debug = require('debug')('things-factory:notification:directive-notification')\n\nconst DIRECTIVE = 'notification'\n\nexport const notificationDirectiveTypeDefs = gql`\n directive @notification(\n receivers: String\n topic: String\n subject: String # info\n title: String\n body: String\n image: String\n url: String\n # timestamp = String(Date.now())\n mode: String # background\n ) on FIELD_DEFINITION\n`\nexport const directiveNotification = (schema: GraphQLSchema) =>\n mapSchema(schema, {\n [MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName, typeName, schema) => {\n const notificationDirective = getDirective(schema, fieldConfig, DIRECTIVE)?.[0]\n if (notificationDirective) {\n const { resolve = defaultFieldResolver, args } = fieldConfig\n\n if (!args) {\n throw new Error(`Unexpected Error. args should be defined in @notification directive for field ${fieldName}.`)\n }\n\n const {\n receivers,\n topic,\n subject = 'info',\n title,\n body,\n image,\n url,\n mode = 'background'\n } = notificationDirective\n const timestamp = Date.now()\n\n fieldConfig.resolve = async function (source, args, context, info) {\n const result = await resolve.call(this, source, args, context, info)\n\n const { domain, user, notify } = context.state\n\n if (!notify) {\n debug('notify not set')\n } else {\n try {\n await notify({\n receivers: [user.id],\n notificationDirective,\n timestamp: new Date()\n })\n } catch (err) {\n debug(err)\n }\n }\n\n return result\n }\n\n return fieldConfig\n }\n }\n })\n"]}