@things-factory/calendar 10.1.47 → 10.1.105
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/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/attendee/attendee-mutation.js +6 -0
- package/dist-server/service/attendee/attendee-mutation.js.map +1 -1
- package/dist-server/service/attendee/attendee.js +1 -1
- package/dist-server/service/attendee/attendee.js.map +1 -1
- package/dist-server/service/calendar/calendar-mutation.js +6 -0
- package/dist-server/service/calendar/calendar-mutation.js.map +1 -1
- package/dist-server/service/event/event-mutation.js +6 -0
- package/dist-server/service/event/event-mutation.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/tests/open-doors.test.ts +41 -0
|
@@ -75,6 +75,7 @@ let AttendeeMutation = class AttendeeMutation {
|
|
|
75
75
|
exports.AttendeeMutation = AttendeeMutation;
|
|
76
76
|
tslib_1.__decorate([
|
|
77
77
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
78
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
78
79
|
(0, type_graphql_1.Mutation)(returns => attendee_1.Attendee, { description: 'To create new Attendee' }),
|
|
79
80
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('attendee')),
|
|
80
81
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -84,6 +85,7 @@ tslib_1.__decorate([
|
|
|
84
85
|
], AttendeeMutation.prototype, "createAttendee", null);
|
|
85
86
|
tslib_1.__decorate([
|
|
86
87
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
88
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
87
89
|
(0, type_graphql_1.Mutation)(returns => attendee_1.Attendee, { description: 'To modify Attendee information' }),
|
|
88
90
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
89
91
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
@@ -94,6 +96,7 @@ tslib_1.__decorate([
|
|
|
94
96
|
], AttendeeMutation.prototype, "updateAttendee", null);
|
|
95
97
|
tslib_1.__decorate([
|
|
96
98
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
99
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
97
100
|
(0, type_graphql_1.Mutation)(returns => [attendee_1.Attendee], { description: "To modify multiple Attendees' information" }),
|
|
98
101
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [attendee_type_1.AttendeePatch])),
|
|
99
102
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -103,6 +106,7 @@ tslib_1.__decorate([
|
|
|
103
106
|
], AttendeeMutation.prototype, "updateMultipleAttendee", null);
|
|
104
107
|
tslib_1.__decorate([
|
|
105
108
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
109
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
106
110
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Attendee' }),
|
|
107
111
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
108
112
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -112,6 +116,7 @@ tslib_1.__decorate([
|
|
|
112
116
|
], AttendeeMutation.prototype, "deleteAttendee", null);
|
|
113
117
|
tslib_1.__decorate([
|
|
114
118
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
119
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
115
120
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Attendees' }),
|
|
116
121
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
117
122
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -121,6 +126,7 @@ tslib_1.__decorate([
|
|
|
121
126
|
], AttendeeMutation.prototype, "deleteAttendees", null);
|
|
122
127
|
tslib_1.__decorate([
|
|
123
128
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
129
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
124
130
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Attendees' }),
|
|
125
131
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('attendees', type => [attendee_type_1.AttendeePatch])),
|
|
126
132
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attendee-mutation.js","sourceRoot":"","sources":["../../../server/service/attendee/attendee-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAqC;AACrC,mDAA4D;AAGrD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;
|
|
1
|
+
{"version":3,"file":"attendee-mutation.js","sourceRoot":"","sources":["../../../server/service/attendee/attendee-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAqC;AACrC,mDAA4D;AAGrD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAIrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAAqB,EAAS,OAAwB;QAC1F,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,mBAAQ,CAAC,CAAC,IAAI,CAAC;YAC3C,GAAG,QAAQ;SACZ,CAAC,CAAA;IACJ,CAAC;IAKK,AAAN,KAAK,CAAC,cAAc,CACP,EAAU,EACP,KAAoB,EAC3B,OAAwB;QAE/B,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,MA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AAC,6BAAa,CAAC,CAAC,CAAA;IACvC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAoCP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sDAMjD;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAE3E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDASP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAE3E,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,6BAAa,CAAC,CAAC,CAAA;IACzC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAWP;2BAvHU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAwH5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Attendee } from './attendee'\nimport { NewAttendee, AttendeePatch } from './attendee-type'\n\n@Resolver(Attendee)\nexport class AttendeeMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Attendee, { description: 'To create new Attendee' })\n async createAttendee(@Arg('attendee') attendee: NewAttendee, @Ctx() context: ResolverContext): Promise<Attendee> {\n const { tx } = context.state\n\n return await tx.getRepository(Attendee).save({\n ...attendee\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Attendee, { description: 'To modify Attendee information' })\n async updateAttendee(\n @Arg('id') id: string,\n @Arg('patch') patch: AttendeePatch,\n @Ctx() context: ResolverContext\n ): Promise<Attendee> {\n const { tx } = context.state\n\n const repository = tx.getRepository(Attendee)\n const attendee = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...attendee,\n ...patch\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Attendee], { description: \"To modify multiple Attendees' information\" })\n async updateMultipleAttendee(\n @Arg('patches', type => [AttendeePatch]) patches: AttendeePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Attendee[]> {\n const { 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 attendeeRepo = tx.getRepository(Attendee)\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 attendeeRepo.save({\n ...newRecord\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 attendee = await attendeeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await attendeeRepo.save({\n ...attendee,\n ...updateRecord\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Attendee' })\n async deleteAttendee(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(Attendee).delete({ id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Attendees' })\n async deleteAttendees(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(Attendee).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Attendees' })\n async importAttendees(\n @Arg('attendees', type => [AttendeePatch]) attendees: AttendeePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await Promise.all(\n attendees.map(async (attendee: AttendeePatch) => {\n const createdAttendee: Attendee = await tx.getRepository(Attendee).save({ ...attendee })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -36,7 +36,7 @@ tslib_1.__decorate([
|
|
|
36
36
|
tslib_1.__decorate([
|
|
37
37
|
(0, typeorm_1.ManyToMany)(() => event_1.Event),
|
|
38
38
|
(0, typeorm_1.JoinTable)(),
|
|
39
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
39
|
+
(0, type_graphql_1.Field)(type => [event_1.Event], { nullable: true }),
|
|
40
40
|
tslib_1.__metadata("design:type", Array)
|
|
41
41
|
], Attendee.prototype, "events", void 0);
|
|
42
42
|
exports.Attendee = Attendee = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attendee.js","sourceRoot":"","sources":["../../../server/service/attendee/attendee.ts"],"names":[],"mappings":";;;;AAAA,qCAA8F;AAC9F,+CAA2E;AAC3E,qDAAqD;AAErD,0CAAsC;AAEtC,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;AACvB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAA,+BAAgB,EAAC,cAAc,EAAE;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iCAAiC;CAC/C,CAAC,CAAA;AAKK,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAiBpB,CAAA;AAjBY,4BAAQ;AAGV;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;oCACC;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACb;AAIb;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,qCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAC1C;AAKb;IAHC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,aAAK,CAAC;IACvB,IAAA,mBAAS,GAAE;IACX,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;
|
|
1
|
+
{"version":3,"file":"attendee.js","sourceRoot":"","sources":["../../../server/service/attendee/attendee.ts"],"names":[],"mappings":";;;;AAAA,qCAA8F;AAC9F,+CAA2E;AAC3E,qDAAqD;AAErD,0CAAsC;AAEtC,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;AACvB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAA,+BAAgB,EAAC,cAAc,EAAE;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iCAAiC;CAC/C,CAAC,CAAA;AAKK,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAiBpB,CAAA;AAjBY,4BAAQ;AAGV;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;oCACC;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACb;AAIb;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,qCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAC1C;AAKb;IAHC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,aAAK,CAAC;IACvB,IAAA,mBAAS,GAAE;IACX,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAC5B;mBAhBJ,QAAQ;IAHpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,eAAe,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACnF,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAiBpB","sourcesContent":["import { Entity, Index, Column, ManyToMany, JoinTable, PrimaryGeneratedColumn } from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\n\nimport { Event } from '../event/event'\n\nexport enum AttendeeStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nregisterEnumType(AttendeeStatus, {\n name: 'AttendeeStatus',\n description: 'state enumeration of a attendee'\n})\n\n@Entity()\n@Index('ix_attendee_0', (attendee: Attendee) => [attendee.email], { unique: false })\n@ObjectType({ description: 'Entity for Attendee' })\nexport class Attendee {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column()\n @Field({ nullable: true })\n name?: string\n\n @Column()\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email: string\n\n @ManyToMany(() => Event)\n @JoinTable()\n @Field(type => [Event], { nullable: true })\n events: Event[]\n}\n"]}
|
|
@@ -90,6 +90,7 @@ let CalendarMutation = class CalendarMutation {
|
|
|
90
90
|
exports.CalendarMutation = CalendarMutation;
|
|
91
91
|
tslib_1.__decorate([
|
|
92
92
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
93
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
93
94
|
(0, type_graphql_1.Mutation)(returns => calendar_1.Calendar, { description: 'To create new Calendar' }),
|
|
94
95
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('calendar')),
|
|
95
96
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -99,6 +100,7 @@ tslib_1.__decorate([
|
|
|
99
100
|
], CalendarMutation.prototype, "createCalendar", null);
|
|
100
101
|
tslib_1.__decorate([
|
|
101
102
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
103
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
102
104
|
(0, type_graphql_1.Mutation)(returns => calendar_1.Calendar, { description: 'To modify Calendar information' }),
|
|
103
105
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
104
106
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
@@ -109,6 +111,7 @@ tslib_1.__decorate([
|
|
|
109
111
|
], CalendarMutation.prototype, "updateCalendar", null);
|
|
110
112
|
tslib_1.__decorate([
|
|
111
113
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
114
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
112
115
|
(0, type_graphql_1.Mutation)(returns => [calendar_1.Calendar], { description: "To modify multiple Calendars' information" }),
|
|
113
116
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [calendar_type_1.CalendarPatch])),
|
|
114
117
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -118,6 +121,7 @@ tslib_1.__decorate([
|
|
|
118
121
|
], CalendarMutation.prototype, "updateMultipleCalendar", null);
|
|
119
122
|
tslib_1.__decorate([
|
|
120
123
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
124
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
121
125
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Calendar' }),
|
|
122
126
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
123
127
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -127,6 +131,7 @@ tslib_1.__decorate([
|
|
|
127
131
|
], CalendarMutation.prototype, "deleteCalendar", null);
|
|
128
132
|
tslib_1.__decorate([
|
|
129
133
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
134
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
130
135
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Calendars' }),
|
|
131
136
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
132
137
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -136,6 +141,7 @@ tslib_1.__decorate([
|
|
|
136
141
|
], CalendarMutation.prototype, "deleteCalendars", null);
|
|
137
142
|
tslib_1.__decorate([
|
|
138
143
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
144
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
139
145
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Calendars' }),
|
|
140
146
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('calendars', type => [calendar_type_1.CalendarPatch])),
|
|
141
147
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-mutation.js","sourceRoot":"","sources":["../../../server/service/calendar/calendar-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAqC;AACrC,mDAA4D;AAGrD,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,mBAAQ,CAAC,CAAC,IAAI,CAAC;YACnD,GAAG,QAAQ;YACX,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,cAAc,CACP,EAAU,EACP,KAAoB,EAC3B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,mBAAQ,CAAC,CAAA;QAC7C,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAA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mI5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Calendar } from './calendar'\nimport { NewCalendar, CalendarPatch } from './calendar-type'\n\n@Resolver(Calendar)\nexport class CalendarMutation {\n @Directive('@transaction')\n @Mutation(returns => Calendar, { description: 'To create new Calendar' })\n async createCalendar(@Arg('calendar') calendar: NewCalendar, @Ctx() context: ResolverContext): Promise<Calendar> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Calendar).save({\n ...calendar,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Calendar, { description: 'To modify Calendar information' })\n async updateCalendar(\n @Arg('id') id: string,\n @Arg('patch') patch: CalendarPatch,\n @Ctx() context: ResolverContext\n ): Promise<Calendar> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Calendar)\n const calendar = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...calendar,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Calendar], { description: \"To modify multiple Calendars' information\" })\n async updateMultipleCalendar(\n @Arg('patches', type => [CalendarPatch]) patches: CalendarPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Calendar[]> {\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 calendarRepo = tx.getRepository(Calendar)\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 calendarRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\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 calendar = await calendarRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!calendar) {\n throw new Error(`failed to find calendar to update: ${updateRecord.id}`)\n }\n\n const result = await calendarRepo.save({\n ...calendar,\n ...updateRecord,\n updater: user\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 Calendar' })\n async deleteCalendar(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Calendar).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Calendars' })\n async deleteCalendars(\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(Calendar).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple Calendars' })\n async importCalendars(\n @Arg('calendars', type => [CalendarPatch]) calendars: CalendarPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n calendars.map(async (calendar: CalendarPatch) => {\n const createdCalendar: Calendar = await tx.getRepository(Calendar).save({ domain, ...calendar })\n })\n )\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"calendar-mutation.js","sourceRoot":"","sources":["../../../server/service/calendar/calendar-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAqC;AACrC,mDAA4D;AAGrD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAIrB,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,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mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sDAMjD;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAE3E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAUP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAE3E,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,6BAAa,CAAC,CAAC,CAAA;IACzC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAWP;2BAxIU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAyI5B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Calendar } from './calendar'\nimport { NewCalendar, CalendarPatch } from './calendar-type'\n\n@Resolver(Calendar)\nexport class CalendarMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Calendar, { description: 'To create new Calendar' })\n async createCalendar(@Arg('calendar') calendar: NewCalendar, @Ctx() context: ResolverContext): Promise<Calendar> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Calendar).save({\n ...calendar,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Calendar, { description: 'To modify Calendar information' })\n async updateCalendar(\n @Arg('id') id: string,\n @Arg('patch') patch: CalendarPatch,\n @Ctx() context: ResolverContext\n ): Promise<Calendar> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Calendar)\n const calendar = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...calendar,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Calendar], { description: \"To modify multiple Calendars' information\" })\n async updateMultipleCalendar(\n @Arg('patches', type => [CalendarPatch]) patches: CalendarPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Calendar[]> {\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 calendarRepo = tx.getRepository(Calendar)\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 calendarRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\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 calendar = await calendarRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!calendar) {\n throw new Error(`failed to find calendar to update: ${updateRecord.id}`)\n }\n\n const result = await calendarRepo.save({\n ...calendar,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Calendar' })\n async deleteCalendar(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Calendar).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Calendars' })\n async deleteCalendars(\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(Calendar).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Calendars' })\n async importCalendars(\n @Arg('calendars', type => [CalendarPatch]) calendars: CalendarPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n calendars.map(async (calendar: CalendarPatch) => {\n const createdCalendar: Calendar = await tx.getRepository(Calendar).save({ domain, ...calendar })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -81,6 +81,7 @@ let EventMutation = class EventMutation {
|
|
|
81
81
|
exports.EventMutation = EventMutation;
|
|
82
82
|
tslib_1.__decorate([
|
|
83
83
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
84
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
84
85
|
(0, type_graphql_1.Mutation)(returns => event_1.Event, { description: 'To create new Event' }),
|
|
85
86
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('event')),
|
|
86
87
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -90,6 +91,7 @@ tslib_1.__decorate([
|
|
|
90
91
|
], EventMutation.prototype, "createEvent", null);
|
|
91
92
|
tslib_1.__decorate([
|
|
92
93
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
94
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
93
95
|
(0, type_graphql_1.Mutation)(returns => event_1.Event, { description: 'To modify Event information' }),
|
|
94
96
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
95
97
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
@@ -100,6 +102,7 @@ tslib_1.__decorate([
|
|
|
100
102
|
], EventMutation.prototype, "updateEvent", null);
|
|
101
103
|
tslib_1.__decorate([
|
|
102
104
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
105
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
103
106
|
(0, type_graphql_1.Mutation)(returns => [event_1.Event], { description: "To modify multiple Events' information" }),
|
|
104
107
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [event_type_1.EventPatch])),
|
|
105
108
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -109,6 +112,7 @@ tslib_1.__decorate([
|
|
|
109
112
|
], EventMutation.prototype, "updateMultipleEvent", null);
|
|
110
113
|
tslib_1.__decorate([
|
|
111
114
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
115
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
112
116
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Event' }),
|
|
113
117
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
114
118
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -118,6 +122,7 @@ tslib_1.__decorate([
|
|
|
118
122
|
], EventMutation.prototype, "deleteEvent", null);
|
|
119
123
|
tslib_1.__decorate([
|
|
120
124
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
125
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
121
126
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Events' }),
|
|
122
127
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
123
128
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -127,6 +132,7 @@ tslib_1.__decorate([
|
|
|
127
132
|
], EventMutation.prototype, "deleteEvents", null);
|
|
128
133
|
tslib_1.__decorate([
|
|
129
134
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
135
|
+
(0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
|
|
130
136
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Events' }),
|
|
131
137
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('events', type => [event_type_1.EventPatch])),
|
|
132
138
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-mutation.js","sourceRoot":"","sources":["../../../server/service/event/event-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,mCAA+B;AAC/B,6CAAmD;AAG5C,IAAM,aAAa,GAAnB,MAAM,aAAa;
|
|
1
|
+
{"version":3,"file":"event-mutation.js","sourceRoot":"","sources":["../../../server/service/event/event-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,mCAA+B;AAC/B,6CAAmD;AAG5C,IAAM,aAAa,GAAnB,MAAM,aAAa;IAIlB,AAAN,KAAK,CAAC,WAAW,CAAe,KAAe,EAAS,OAAwB;QAC9E,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAElC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,aAAK,CAAC,CAAC,IAAI,CAAC;YACxC,GAAG,KAAK;YACR,OAAO,EA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AC,CAAC,uBAAU,CAAC,CAAC,CAAA;IACnC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iDAWP;wBA1HU,aAAa;IADzB,IAAA,uBAAQ,EAAC,aAAK,CAAC;GACH,aAAa,CA2HzB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Event } from './event'\nimport { NewEvent, EventPatch } from './event-type'\n\n@Resolver(Event)\nexport class EventMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Event, { description: 'To create new Event' })\n async createEvent(@Arg('event') event: NewEvent, @Ctx() context: ResolverContext): Promise<Event> {\n const { user, tx } = context.state\n\n return await tx.getRepository(Event).save({\n ...event,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Event, { description: 'To modify Event information' })\n async updateEvent(\n @Arg('id') id: string,\n @Arg('patch') patch: EventPatch,\n @Ctx() context: ResolverContext\n ): Promise<Event> {\n const { user, tx } = context.state\n\n const repository = tx.getRepository(Event)\n const event = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...event,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Event], { description: \"To modify multiple Events' information\" })\n async updateMultipleEvent(\n @Arg('patches', type => [EventPatch]) patches: EventPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Event[]> {\n const { 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 eventRepo = tx.getRepository(Event)\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 eventRepo.save({\n ...newRecord,\n creator: user,\n updater: user\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 event = await eventRepo.findOneBy({ id: updateRecord.id })\n\n const result = await eventRepo.save({\n ...event,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Event' })\n async deleteEvent(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(Event).delete({ id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Events' })\n async deleteEvents(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(Event).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Events' })\n async importEvents(\n @Arg('events', type => [EventPatch]) events: EventPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await Promise.all(\n events.map(async (event: EventPatch) => {\n const createdEvent: Event = await tx.getRepository(Event).save({ ...event })\n })\n )\n\n return true\n }\n}\n"]}
|