@things-factory/calendar 10.1.203 → 10.1.205

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 (114) hide show
  1. package/dist-client/pages/calendar/calendar-list-page.d.ts +1 -9
  2. package/dist-client/pages/calendar/calendar-list-page.js +2 -27
  3. package/dist-client/pages/calendar/calendar-list-page.js.map +1 -1
  4. package/dist-client/pages/event/event-list-page.d.ts +5 -28
  5. package/dist-client/pages/event/event-list-page.js +65 -177
  6. package/dist-client/pages/event/event-list-page.js.map +1 -1
  7. package/dist-client/route.d.ts +1 -1
  8. package/dist-client/route.js +0 -3
  9. package/dist-client/route.js.map +1 -1
  10. package/dist-client/tsconfig.tsbuildinfo +1 -1
  11. package/dist-server/index.d.ts +1 -0
  12. package/dist-server/index.js +5 -0
  13. package/dist-server/index.js.map +1 -1
  14. package/dist-server/role-tasks.d.ts +2 -0
  15. package/dist-server/role-tasks.js +16 -0
  16. package/dist-server/role-tasks.js.map +1 -0
  17. package/dist-server/service/attendee/attendee-query.d.ts +7 -4
  18. package/dist-server/service/attendee/attendee-query.js +34 -25
  19. package/dist-server/service/attendee/attendee-query.js.map +1 -1
  20. package/dist-server/service/attendee/attendee-service.d.ts +41 -0
  21. package/dist-server/service/attendee/attendee-service.js +90 -0
  22. package/dist-server/service/attendee/attendee-service.js.map +1 -0
  23. package/dist-server/service/attendee/attendee-type.d.ts +3 -15
  24. package/dist-server/service/attendee/attendee-type.js +12 -53
  25. package/dist-server/service/attendee/attendee-type.js.map +1 -1
  26. package/dist-server/service/attendee/attendee.d.ts +24 -7
  27. package/dist-server/service/attendee/attendee.js +99 -23
  28. package/dist-server/service/attendee/attendee.js.map +1 -1
  29. package/dist-server/service/attendee/index.d.ts +1 -2
  30. package/dist-server/service/attendee/index.js +1 -2
  31. package/dist-server/service/attendee/index.js.map +1 -1
  32. package/dist-server/service/calendar/calendar-mutation.d.ts +1 -3
  33. package/dist-server/service/calendar/calendar-mutation.js +21 -94
  34. package/dist-server/service/calendar/calendar-mutation.js.map +1 -1
  35. package/dist-server/service/calendar/calendar-query.d.ts +1 -1
  36. package/dist-server/service/calendar/calendar-query.js +15 -17
  37. package/dist-server/service/calendar/calendar-query.js.map +1 -1
  38. package/dist-server/service/calendar/calendar-service.d.ts +10 -0
  39. package/dist-server/service/calendar/calendar-service.js +58 -0
  40. package/dist-server/service/calendar/calendar-service.js.map +1 -0
  41. package/dist-server/service/calendar/calendar-type.d.ts +1 -4
  42. package/dist-server/service/calendar/calendar-type.js +13 -25
  43. package/dist-server/service/calendar/calendar-type.js.map +1 -1
  44. package/dist-server/service/calendar/calendar.d.ts +7 -8
  45. package/dist-server/service/calendar/calendar.js +23 -33
  46. package/dist-server/service/calendar/calendar.js.map +1 -1
  47. package/dist-server/service/event/event-mutation.d.ts +6 -4
  48. package/dist-server/service/event/event-mutation.js +60 -83
  49. package/dist-server/service/event/event-mutation.js.map +1 -1
  50. package/dist-server/service/event/event-query.d.ts +11 -1
  51. package/dist-server/service/event/event-query.js +106 -13
  52. package/dist-server/service/event/event-query.js.map +1 -1
  53. package/dist-server/service/event/event-rules.d.ts +10 -0
  54. package/dist-server/service/event/event-rules.js +38 -0
  55. package/dist-server/service/event/event-rules.js.map +1 -0
  56. package/dist-server/service/event/event-service.d.ts +42 -0
  57. package/dist-server/service/event/event-service.js +159 -0
  58. package/dist-server/service/event/event-service.js.map +1 -0
  59. package/dist-server/service/event/event-type.d.ts +10 -11
  60. package/dist-server/service/event/event-type.js +32 -36
  61. package/dist-server/service/event/event-type.js.map +1 -1
  62. package/dist-server/service/event/event.d.ts +25 -11
  63. package/dist-server/service/event/event.js +89 -36
  64. package/dist-server/service/event/event.js.map +1 -1
  65. package/dist-server/service/event-series/event-series-mutation.d.ts +11 -0
  66. package/dist-server/service/event-series/event-series-mutation.js +100 -0
  67. package/dist-server/service/event-series/event-series-mutation.js.map +1 -0
  68. package/dist-server/service/event-series/event-series-query.d.ts +16 -0
  69. package/dist-server/service/event-series/event-series-query.js +109 -0
  70. package/dist-server/service/event-series/event-series-query.js.map +1 -0
  71. package/dist-server/service/event-series/event-series-service.d.ts +40 -0
  72. package/dist-server/service/event-series/event-series-service.js +253 -0
  73. package/dist-server/service/event-series/event-series-service.js.map +1 -0
  74. package/dist-server/service/event-series/event-series-type.d.ts +41 -0
  75. package/dist-server/service/event-series/event-series-type.js +155 -0
  76. package/dist-server/service/event-series/event-series-type.js.map +1 -0
  77. package/dist-server/service/event-series/event-series.d.ts +32 -0
  78. package/dist-server/service/event-series/event-series.js +134 -0
  79. package/dist-server/service/event-series/event-series.js.map +1 -0
  80. package/dist-server/service/event-series/index.d.ts +6 -0
  81. package/dist-server/service/event-series/index.js +10 -0
  82. package/dist-server/service/event-series/index.js.map +1 -0
  83. package/dist-server/service/event-series/recurrence.d.ts +19 -0
  84. package/dist-server/service/event-series/recurrence.js +95 -0
  85. package/dist-server/service/event-series/recurrence.js.map +1 -0
  86. package/dist-server/service/index.d.ts +15 -4
  87. package/dist-server/service/index.js +29 -11
  88. package/dist-server/service/index.js.map +1 -1
  89. package/dist-server/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +8 -5
  91. package/tests/open-doors.test.ts +18 -21
  92. package/things-factory.config.js +0 -4
  93. package/translations/en.json +44 -1
  94. package/translations/es.json +44 -1
  95. package/translations/ja.json +44 -1
  96. package/translations/ko.json +44 -1
  97. package/translations/ms.json +44 -1
  98. package/translations/zh.json +44 -1
  99. package/concept.md +0 -31
  100. package/dist-client/pages/attendee/attendee-importer.d.ts +0 -23
  101. package/dist-client/pages/attendee/attendee-importer.js +0 -93
  102. package/dist-client/pages/attendee/attendee-importer.js.map +0 -1
  103. package/dist-client/pages/attendee/attendee-list-page.d.ts +0 -56
  104. package/dist-client/pages/attendee/attendee-list-page.js +0 -263
  105. package/dist-client/pages/attendee/attendee-list-page.js.map +0 -1
  106. package/dist-client/pages/calendar/calendar-importer.d.ts +0 -23
  107. package/dist-client/pages/calendar/calendar-importer.js +0 -93
  108. package/dist-client/pages/calendar/calendar-importer.js.map +0 -1
  109. package/dist-client/pages/event/event-importer.d.ts +0 -23
  110. package/dist-client/pages/event/event-importer.js +0 -93
  111. package/dist-client/pages/event/event-importer.js.map +0 -1
  112. package/dist-server/service/attendee/attendee-mutation.d.ts +0 -10
  113. package/dist-server/service/attendee/attendee-mutation.js +0 -140
  114. package/dist-server/service/attendee/attendee-mutation.js.map +0 -1
@@ -2,85 +2,81 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventList = exports.EventPatch = exports.NewEvent = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
6
5
  const type_graphql_1 = require("type-graphql");
6
+ const attendee_type_1 = require("../attendee/attendee-type");
7
7
  const event_1 = require("./event");
8
8
  let NewEvent = class NewEvent {
9
9
  };
10
10
  exports.NewEvent = NewEvent;
11
11
  tslib_1.__decorate([
12
- (0, type_graphql_1.Field)(),
12
+ (0, type_graphql_1.Field)({ description: 'Name of the event' }),
13
13
  tslib_1.__metadata("design:type", String)
14
14
  ], NewEvent.prototype, "name", void 0);
15
15
  tslib_1.__decorate([
16
- (0, type_graphql_1.Field)({ nullable: true }),
16
+ (0, type_graphql_1.Field)({ nullable: true, description: 'What the event is about' }),
17
17
  tslib_1.__metadata("design:type", String)
18
18
  ], NewEvent.prototype, "description", void 0);
19
19
  tslib_1.__decorate([
20
- (0, type_graphql_1.Field)(type => event_1.EventStatus, { nullable: true }),
20
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Where the event takes place' }),
21
21
  tslib_1.__metadata("design:type", String)
22
- ], NewEvent.prototype, "state", void 0);
22
+ ], NewEvent.prototype, "location", void 0);
23
23
  tslib_1.__decorate([
24
- (0, type_graphql_1.Field)({ nullable: true }),
25
- tslib_1.__metadata("design:type", Boolean)
26
- ], NewEvent.prototype, "active", void 0);
24
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Id of the calendar to put the event on' }),
25
+ tslib_1.__metadata("design:type", String)
26
+ ], NewEvent.prototype, "calendarId", void 0);
27
27
  tslib_1.__decorate([
28
- (0, type_graphql_1.Field)({ nullable: true }),
28
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Id of the person responsible; whoever creates it when empty' }),
29
29
  tslib_1.__metadata("design:type", String)
30
- ], NewEvent.prototype, "params", void 0);
30
+ ], NewEvent.prototype, "organizerId", void 0);
31
+ tslib_1.__decorate([
32
+ (0, type_graphql_1.Field)({ description: 'When the event starts' }),
33
+ tslib_1.__metadata("design:type", Date)
34
+ ], NewEvent.prototype, "startAt", void 0);
31
35
  tslib_1.__decorate([
32
- (0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
33
- tslib_1.__metadata("design:type", Object)
34
- ], NewEvent.prototype, "thumbnail", void 0);
36
+ (0, type_graphql_1.Field)({ description: 'When the event ends' }),
37
+ tslib_1.__metadata("design:type", Date)
38
+ ], NewEvent.prototype, "endAt", void 0);
39
+ tslib_1.__decorate([
40
+ (0, type_graphql_1.Field)(type => [attendee_type_1.AttendeeInput], { nullable: true, description: 'The people named on the event' }),
41
+ tslib_1.__metadata("design:type", Array)
42
+ ], NewEvent.prototype, "attendees", void 0);
35
43
  exports.NewEvent = NewEvent = tslib_1.__decorate([
36
- (0, type_graphql_1.InputType)()
44
+ (0, type_graphql_1.InputType)({ description: 'A one-off event to create' })
37
45
  ], NewEvent);
38
46
  let EventPatch = class EventPatch {
39
47
  };
40
48
  exports.EventPatch = EventPatch;
41
49
  tslib_1.__decorate([
42
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
43
- tslib_1.__metadata("design:type", String)
44
- ], EventPatch.prototype, "id", void 0);
45
- tslib_1.__decorate([
46
- (0, type_graphql_1.Field)({ nullable: true }),
50
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Name of the event' }),
47
51
  tslib_1.__metadata("design:type", String)
48
52
  ], EventPatch.prototype, "name", void 0);
49
53
  tslib_1.__decorate([
50
- (0, type_graphql_1.Field)({ nullable: true }),
54
+ (0, type_graphql_1.Field)({ nullable: true, description: 'What the event is about' }),
51
55
  tslib_1.__metadata("design:type", String)
52
56
  ], EventPatch.prototype, "description", void 0);
53
57
  tslib_1.__decorate([
54
- (0, type_graphql_1.Field)(type => event_1.EventStatus, { nullable: true }),
58
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Where the event takes place' }),
55
59
  tslib_1.__metadata("design:type", String)
56
- ], EventPatch.prototype, "state", void 0);
57
- tslib_1.__decorate([
58
- (0, type_graphql_1.Field)({ nullable: true }),
59
- tslib_1.__metadata("design:type", Boolean)
60
- ], EventPatch.prototype, "active", void 0);
61
- tslib_1.__decorate([
62
- (0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
63
- tslib_1.__metadata("design:type", Object)
64
- ], EventPatch.prototype, "thumbnail", void 0);
60
+ ], EventPatch.prototype, "location", void 0);
65
61
  tslib_1.__decorate([
66
- (0, type_graphql_1.Field)({ nullable: true }),
62
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Id of the person responsible' }),
67
63
  tslib_1.__metadata("design:type", String)
68
- ], EventPatch.prototype, "cuFlag", void 0);
64
+ ], EventPatch.prototype, "organizerId", void 0);
69
65
  exports.EventPatch = EventPatch = tslib_1.__decorate([
70
- (0, type_graphql_1.InputType)()
66
+ (0, type_graphql_1.InputType)({ description: 'What changes on an event, apart from its time and status' })
71
67
  ], EventPatch);
72
68
  let EventList = class EventList {
73
69
  };
74
70
  exports.EventList = EventList;
75
71
  tslib_1.__decorate([
76
- (0, type_graphql_1.Field)(type => [event_1.Event]),
72
+ (0, type_graphql_1.Field)(type => [event_1.Event], { description: 'The events on this page' }),
77
73
  tslib_1.__metadata("design:type", Array)
78
74
  ], EventList.prototype, "items", void 0);
79
75
  tslib_1.__decorate([
80
- (0, type_graphql_1.Field)(type => type_graphql_1.Int),
76
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'How many events match in all' }),
81
77
  tslib_1.__metadata("design:type", Number)
82
78
  ], EventList.prototype, "total", void 0);
83
79
  exports.EventList = EventList = tslib_1.__decorate([
84
- (0, type_graphql_1.ObjectType)()
80
+ (0, type_graphql_1.ObjectType)({ description: 'A page of events' })
85
81
  ], EventList);
86
82
  //# sourceMappingURL=event-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-type.js","sourceRoot":"","sources":["../../../server/service/event/event-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AAItF,mCAA4C;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAkBpB,CAAA;AAlBY,4BAAQ;AAEnB;IADC,IAAA,oBAAK,GAAE;;sCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,mBAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAC5B;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACX;AAGf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC3B;mBAjBX,QAAQ;IADpB,IAAA,wBAAS,GAAE;GACC,QAAQ,CAkBpB;AAGM,IAAM,UAAU,GAAhB,MAAM,UAAU;CAqBtB,CAAA;AArBY,gCAAU;AAErB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,mBAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC5B;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,0BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC3B;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACX;qBApBJ,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAqBtB;AAGM,IAAM,SAAS,GAAf,MAAM,SAAS;CAMrB,CAAA;AANY,8BAAS;AAEpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,aAAK,CAAC,CAAC;;wCACT;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;wCACN;oBALF,SAAS;IADrB,IAAA,yBAAU,GAAE;GACA,SAAS,CAMrB","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Event, EventStatus } from './event'\n\n@InputType()\nexport class NewEvent {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => EventStatus, { nullable: true })\n state?: EventStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n params?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n}\n\n@InputType()\nexport class EventPatch {\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 => EventStatus, { nullable: true })\n state?: EventStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class EventList {\n @Field(type => [Event])\n items: Event[]\n\n @Field(type => Int)\n total: number\n}\n"]}
1
+ {"version":3,"file":"event-type.js","sourceRoot":"","sources":["../../../server/service/event/event-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAEhE,6DAAyD;AACzD,mCAA+B;AAGxB,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAwBpB,CAAA;AAxBY,4BAAQ;AAEnB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;sCAChC;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;;6CAC9C;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;;0CACrD;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;4CAC9D;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,6DAA6D,EAAE,CAAC;;6CAClF;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;sCACvC,IAAI;yCAAA;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;sCACvC,IAAI;uCAAA;AAGX;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,6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ee/attendee-type'\nimport { Event } from './event'\n\n@InputType({ description: 'A one-off event to create' })\nexport class NewEvent {\n @Field({ description: 'Name of the event' })\n name: string\n\n @Field({ nullable: true, description: 'What the event is about' })\n description?: string\n\n @Field({ nullable: true, description: 'Where the event takes place' })\n location?: string\n\n @Field({ nullable: true, description: 'Id of the calendar to put the event on' })\n calendarId?: string\n\n @Field({ nullable: true, description: 'Id of the person responsible; whoever creates it when empty' })\n organizerId?: string\n\n @Field({ description: 'When the event starts' })\n startAt: Date\n\n @Field({ description: 'When the event ends' })\n endAt: Date\n\n @Field(type => [AttendeeInput], { nullable: true, description: 'The people named on the event' })\n attendees?: AttendeeInput[]\n}\n\n@InputType({ description: 'What changes on an event, apart from its time and status' })\nexport class EventPatch {\n @Field({ nullable: true, description: 'Name of the event' })\n name?: string\n\n @Field({ nullable: true, description: 'What the event is about' })\n description?: string\n\n @Field({ nullable: true, description: 'Where the event takes place' })\n location?: string\n\n @Field({ nullable: true, description: 'Id of the person responsible' })\n organizerId?: string\n}\n\n@ObjectType({ description: 'A page of events' })\nexport class EventList {\n @Field(type => [Event], { description: 'The events on this page' })\n items: Event[]\n\n @Field(type => Int, { description: 'How many events match in all' })\n total: number\n}\n"]}
@@ -1,20 +1,34 @@
1
+ import { Domain } from '@things-factory/shell';
1
2
  import { User } from '@things-factory/auth-base';
2
- import { Attendee } from '../attendee/attendee';
3
- export declare enum EventStatus {
4
- STATUS_A = "STATUS_A",
5
- STATUS_B = "STATUS_B"
6
- }
3
+ import { Calendar } from '../calendar/calendar';
4
+ import { EventSeries } from '../event-series/event-series';
5
+ import { EventStatus } from './event-rules';
6
+ /**
7
+ * Something that takes place at a time — on its own, or as one occurrence of a series. An occurrence is named by its
8
+ * series and `scheduledAt`, the time the rule gave it; postponing moves `startAt`/`endAt` and never `scheduledAt`, so
9
+ * creating the series' occurrences again finds it and makes no second one.
10
+ */
7
11
  export declare class Event {
8
12
  readonly id: string;
9
- name?: string;
13
+ domain?: Domain;
14
+ domainId?: string;
15
+ calendar?: Calendar;
16
+ calendarId?: string;
17
+ series?: EventSeries;
18
+ seriesId?: string;
19
+ scheduledAt: Date;
20
+ startAt: Date;
21
+ endAt: Date;
22
+ status: EventStatus;
23
+ statusReason?: string;
24
+ name: string;
10
25
  description?: string;
11
- startDateTime: Date;
12
- endDateTime: Date;
13
- location: string;
14
- attendees: Attendee[];
15
- state?: EventStatus;
26
+ location?: string;
27
+ organizer?: User;
28
+ organizerId?: string;
16
29
  createdAt?: Date;
17
30
  updatedAt?: Date;
31
+ deletedAt?: Date;
18
32
  creator?: User;
19
33
  creatorId?: string;
20
34
  updater?: User;
@@ -1,77 +1,124 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Event = exports.EventStatus = void 0;
3
+ exports.Event = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const typeorm_1 = require("typeorm");
6
6
  const type_graphql_1 = require("type-graphql");
7
+ const shell_1 = require("@things-factory/shell");
7
8
  const auth_base_1 = require("@things-factory/auth-base");
8
- const attendee_1 = require("../attendee/attendee");
9
- var EventStatus;
10
- (function (EventStatus) {
11
- EventStatus["STATUS_A"] = "STATUS_A";
12
- EventStatus["STATUS_B"] = "STATUS_B";
13
- })(EventStatus || (exports.EventStatus = EventStatus = {}));
14
- (0, type_graphql_1.registerEnumType)(EventStatus, {
15
- name: 'EventStatus',
16
- description: 'state enumeration of a event'
17
- });
9
+ const calendar_1 = require("../calendar/calendar");
10
+ const event_series_1 = require("../event-series/event-series");
11
+ const event_rules_1 = require("./event-rules");
12
+ /**
13
+ * Something that takes place at a time — on its own, or as one occurrence of a series. An occurrence is named by its
14
+ * series and `scheduledAt`, the time the rule gave it; postponing moves `startAt`/`endAt` and never `scheduledAt`, so
15
+ * creating the series' occurrences again finds it and makes no second one.
16
+ */
18
17
  let Event = class Event {
19
18
  };
20
19
  exports.Event = Event;
21
20
  tslib_1.__decorate([
22
21
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
23
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
22
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier of the event' }),
24
23
  tslib_1.__metadata("design:type", String)
25
24
  ], Event.prototype, "id", void 0);
26
25
  tslib_1.__decorate([
27
- (0, typeorm_1.Column)(),
28
- (0, type_graphql_1.Field)({ nullable: true }),
26
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
27
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain the event belongs to' }),
28
+ tslib_1.__metadata("design:type", shell_1.Domain)
29
+ ], Event.prototype, "domain", void 0);
30
+ tslib_1.__decorate([
31
+ (0, typeorm_1.RelationId)((event) => event.domain),
29
32
  tslib_1.__metadata("design:type", String)
30
- ], Event.prototype, "name", void 0);
33
+ ], Event.prototype, "domainId", void 0);
31
34
  tslib_1.__decorate([
32
- (0, typeorm_1.Column)({ nullable: true }),
33
- (0, type_graphql_1.Field)({ nullable: true }),
35
+ (0, typeorm_1.ManyToOne)(type => calendar_1.Calendar, { nullable: true }),
36
+ (0, type_graphql_1.Field)(type => calendar_1.Calendar, { nullable: true, description: 'The calendar the event belongs to, if any' }),
37
+ tslib_1.__metadata("design:type", calendar_1.Calendar)
38
+ ], Event.prototype, "calendar", void 0);
39
+ tslib_1.__decorate([
40
+ (0, typeorm_1.RelationId)((event) => event.calendar),
41
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Id of the calendar the event belongs to' }),
34
42
  tslib_1.__metadata("design:type", String)
35
- ], Event.prototype, "description", void 0);
43
+ ], Event.prototype, "calendarId", void 0);
44
+ tslib_1.__decorate([
45
+ (0, typeorm_1.ManyToOne)(type => event_series_1.EventSeries, { nullable: true }),
46
+ (0, type_graphql_1.Field)(type => event_series_1.EventSeries, { nullable: true, description: 'The series this event is an occurrence of; empty for a one-off event' }),
47
+ tslib_1.__metadata("design:type", event_series_1.EventSeries)
48
+ ], Event.prototype, "series", void 0);
49
+ tslib_1.__decorate([
50
+ (0, typeorm_1.RelationId)((event) => event.series),
51
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Id of the series this event is an occurrence of' }),
52
+ tslib_1.__metadata("design:type", String)
53
+ ], Event.prototype, "seriesId", void 0);
36
54
  tslib_1.__decorate([
37
55
  (0, typeorm_1.Column)(),
38
- (0, type_graphql_1.Field)({ nullable: true }),
56
+ (0, type_graphql_1.Field)({ description: 'The time the event was first given — the rule\'s time for an occurrence. It never moves' }),
39
57
  tslib_1.__metadata("design:type", Date)
40
- ], Event.prototype, "startDateTime", void 0);
58
+ ], Event.prototype, "scheduledAt", void 0);
41
59
  tslib_1.__decorate([
42
60
  (0, typeorm_1.Column)(),
43
- (0, type_graphql_1.Field)({ nullable: true }),
61
+ (0, type_graphql_1.Field)({ description: 'When the event starts' }),
44
62
  tslib_1.__metadata("design:type", Date)
45
- ], Event.prototype, "endDateTime", void 0);
63
+ ], Event.prototype, "startAt", void 0);
64
+ tslib_1.__decorate([
65
+ (0, typeorm_1.Column)(),
66
+ (0, type_graphql_1.Field)({ description: 'When the event ends' }),
67
+ tslib_1.__metadata("design:type", Date)
68
+ ], Event.prototype, "endAt", void 0);
69
+ tslib_1.__decorate([
70
+ (0, typeorm_1.Column)({ default: event_rules_1.EventStatus.SCHEDULED }),
71
+ (0, type_graphql_1.Field)(type => event_rules_1.EventStatus, { description: 'Scheduled, postponed, cancelled or held' }),
72
+ tslib_1.__metadata("design:type", String)
73
+ ], Event.prototype, "status", void 0);
74
+ tslib_1.__decorate([
75
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
76
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Why it was last postponed or cancelled' }),
77
+ tslib_1.__metadata("design:type", String)
78
+ ], Event.prototype, "statusReason", void 0);
79
+ tslib_1.__decorate([
80
+ (0, typeorm_1.Column)(),
81
+ (0, type_graphql_1.Field)({ description: 'Name of the event' }),
82
+ tslib_1.__metadata("design:type", String)
83
+ ], Event.prototype, "name", void 0);
84
+ tslib_1.__decorate([
85
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
86
+ (0, type_graphql_1.Field)({ nullable: true, description: 'What the event is about' }),
87
+ tslib_1.__metadata("design:type", String)
88
+ ], Event.prototype, "description", void 0);
46
89
  tslib_1.__decorate([
47
90
  (0, typeorm_1.Column)({ nullable: true }),
48
- (0, type_graphql_1.Field)({ nullable: true }),
91
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Where the event takes place' }),
49
92
  tslib_1.__metadata("design:type", String)
50
93
  ], Event.prototype, "location", void 0);
51
94
  tslib_1.__decorate([
52
- (0, typeorm_1.ManyToMany)(() => attendee_1.Attendee),
53
- (0, typeorm_1.JoinTable)(),
54
- (0, type_graphql_1.Field)(type => [attendee_1.Attendee], { nullable: true }),
55
- tslib_1.__metadata("design:type", Array)
56
- ], Event.prototype, "attendees", void 0);
95
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
96
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'The person responsible for the event' }),
97
+ tslib_1.__metadata("design:type", auth_base_1.User)
98
+ ], Event.prototype, "organizer", void 0);
57
99
  tslib_1.__decorate([
58
- (0, typeorm_1.Column)({ nullable: true }),
59
- (0, type_graphql_1.Field)({ nullable: true }),
100
+ (0, typeorm_1.RelationId)((event) => event.organizer),
101
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Id of the person responsible for the event' }),
60
102
  tslib_1.__metadata("design:type", String)
61
- ], Event.prototype, "state", void 0);
103
+ ], Event.prototype, "organizerId", void 0);
62
104
  tslib_1.__decorate([
63
105
  (0, typeorm_1.CreateDateColumn)(),
64
- (0, type_graphql_1.Field)({ nullable: true }),
106
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Creation timestamp' }),
65
107
  tslib_1.__metadata("design:type", Date)
66
108
  ], Event.prototype, "createdAt", void 0);
67
109
  tslib_1.__decorate([
68
110
  (0, typeorm_1.UpdateDateColumn)(),
69
- (0, type_graphql_1.Field)({ nullable: true }),
111
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Last update timestamp' }),
70
112
  tslib_1.__metadata("design:type", Date)
71
113
  ], Event.prototype, "updatedAt", void 0);
114
+ tslib_1.__decorate([
115
+ (0, typeorm_1.DeleteDateColumn)(),
116
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Soft delete timestamp' }),
117
+ tslib_1.__metadata("design:type", Date)
118
+ ], Event.prototype, "deletedAt", void 0);
72
119
  tslib_1.__decorate([
73
120
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
74
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
121
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who created the event' }),
75
122
  tslib_1.__metadata("design:type", auth_base_1.User)
76
123
  ], Event.prototype, "creator", void 0);
77
124
  tslib_1.__decorate([
@@ -80,7 +127,7 @@ tslib_1.__decorate([
80
127
  ], Event.prototype, "creatorId", void 0);
81
128
  tslib_1.__decorate([
82
129
  (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
83
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
130
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who last changed the event' }),
84
131
  tslib_1.__metadata("design:type", auth_base_1.User)
85
132
  ], Event.prototype, "updater", void 0);
86
133
  tslib_1.__decorate([
@@ -89,6 +136,12 @@ tslib_1.__decorate([
89
136
  ], Event.prototype, "updaterId", void 0);
90
137
  exports.Event = Event = tslib_1.__decorate([
91
138
  (0, typeorm_1.Entity)(),
92
- (0, type_graphql_1.ObjectType)({ description: 'Entity for Event' })
139
+ (0, typeorm_1.Index)('ix_event_0', (event) => [event.domain, event.series, event.scheduledAt], {
140
+ unique: true,
141
+ where: '"deleted_at" IS NULL AND "series_id" IS NOT NULL'
142
+ }),
143
+ (0, typeorm_1.Index)('ix_event_1', (event) => [event.domain, event.startAt]),
144
+ (0, typeorm_1.Index)('ix_event_2', (event) => [event.domain, event.calendar, event.startAt]),
145
+ (0, type_graphql_1.ObjectType)({ description: 'Something that takes place at a time, on its own or as an occurrence of a series' })
93
146
  ], Event);
94
147
  //# sourceMappingURL=event.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../server/service/event/event.ts"],"names":[],"mappings":";;;;AAAA,qCAWgB;AAChB,+CAA2E;AAE3E,yDAAgD;AAChD,mDAA+C;AAE/C,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;AACvB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAED,IAAA,+BAAgB,EAAC,WAAW,EAAE;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,8BAA8B;CAC5C,CAAC,CAAA;AAIK,IAAM,KAAK,GAAX,MAAM,KAAK;CAuDjB,CAAA;AAvDY,sBAAK;AAGP;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;iCACC;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mCACb;AAIb;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACN;AAIpB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACX,IAAI;4CAAA;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACb,IAAI;0CAAA;AAIjB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAA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AU,EAAC,CAAC,KAAY,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;wCAC1B;gBAtDP,KAAK;IAFjB,IAAA,gBAAM,GAAE;IACR,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;GACnC,KAAK,CAuDjB","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n ManyToMany,\n JoinTable,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Attendee } from '../attendee/attendee'\n\nexport enum EventStatus {\n STATUS_A = 'STATUS_A',\n STATUS_B = 'STATUS_B'\n}\n\nregisterEnumType(EventStatus, {\n name: 'EventStatus',\n description: 'state enumeration of a event'\n})\n\n@Entity()\n@ObjectType({ description: 'Entity for Event' })\nexport class Event {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: 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()\n @Field({ nullable: true })\n startDateTime: Date\n\n @Column()\n @Field({ nullable: true })\n endDateTime: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n location: string\n\n @ManyToMany(() => Attendee)\n @JoinTable()\n @Field(type => [Attendee], { nullable: true })\n attendees: Attendee[]\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: EventStatus\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((event: Event) => event.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((event: Event) => event.updater)\n updaterId?: string\n}\n"]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AAC,EAAE,WAAW,EAAE,kFAAkF,EAAE,CAAC;GACnG,KAAK,CA6FjB","sourcesContent":["import { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'\nimport { Field, ID, ObjectType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { Calendar } from '../calendar/calendar'\nimport { EventSeries } from '../event-series/event-series'\nimport { EventStatus } from './event-rules'\n\n/**\n * Something that takes place at a time — on its own, or as one occurrence of a series. An occurrence is named by its\n * series and `scheduledAt`, the time the rule gave it; postponing moves `startAt`/`endAt` and never `scheduledAt`, so\n * creating the series' occurrences again finds it and makes no second one.\n */\n@Entity()\n@Index('ix_event_0', (event: Event) => [event.domain, event.series, event.scheduledAt], {\n unique: true,\n where: '\"deleted_at\" IS NULL AND \"series_id\" IS NOT NULL'\n})\n@Index('ix_event_1', (event: Event) => [event.domain, event.startAt])\n@Index('ix_event_2', (event: Event) => [event.domain, event.calendar, event.startAt])\n@ObjectType({ description: 'Something that takes place at a time, on its own or as an occurrence of a series' })\nexport class Event {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier of the event' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain the event belongs to' })\n domain?: Domain\n\n @RelationId((event: Event) => event.domain)\n domainId?: string\n\n @ManyToOne(type => Calendar, { nullable: true })\n @Field(type => Calendar, { nullable: true, description: 'The calendar the event belongs to, if any' })\n calendar?: Calendar\n\n @RelationId((event: Event) => event.calendar)\n @Field({ nullable: true, description: 'Id of the calendar the event belongs to' })\n calendarId?: string\n\n @ManyToOne(type => EventSeries, { nullable: true })\n @Field(type => EventSeries, { nullable: true, description: 'The series this event is an occurrence of; empty for a one-off event' })\n series?: EventSeries\n\n @RelationId((event: Event) => event.series)\n @Field({ nullable: true, description: 'Id of the series this event is an occurrence of' })\n seriesId?: string\n\n @Column()\n @Field({ description: 'The time the event was first given — the rule\\'s time for an occurrence. It never moves' })\n scheduledAt: Date\n\n @Column()\n @Field({ description: 'When the event starts' })\n startAt: Date\n\n @Column()\n @Field({ description: 'When the event ends' })\n endAt: Date\n\n @Column({ default: EventStatus.SCHEDULED })\n @Field(type => EventStatus, { description: 'Scheduled, postponed, cancelled or held' })\n status: EventStatus\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'Why it was last postponed or cancelled' })\n statusReason?: string\n\n @Column()\n @Field({ description: 'Name of the event' })\n name: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'What the event is about' })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Where the event takes place' })\n location?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'The person responsible for the event' })\n organizer?: User\n\n @RelationId((event: Event) => event.organizer)\n @Field({ nullable: true, description: 'Id of the person responsible for the event' })\n organizerId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Creation timestamp' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Last update timestamp' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Soft delete timestamp' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who created the event' })\n creator?: User\n\n @RelationId((event: Event) => event.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who last changed the event' })\n updater?: User\n\n @RelationId((event: Event) => event.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { AttendeeInput } from '../attendee/attendee-type';
2
+ import { Event } from '../event/event';
3
+ import { EventSeries } from './event-series';
4
+ import { EventSeriesChange, EventSeriesPatch, NewEventSeries } from './event-series-type';
5
+ export declare class EventSeriesMutation {
6
+ createEventSeries(series: NewEventSeries, context: ResolverContext): Promise<EventSeries>;
7
+ updateEventSeries(id: string, patch: EventSeriesPatch, preview: boolean, context: ResolverContext): Promise<EventSeriesChange>;
8
+ deleteEventSeries(id: string, preview: boolean, context: ResolverContext): Promise<EventSeriesChange>;
9
+ generateEventOccurrences(id: string, until: Date, context: ResolverContext): Promise<Event[]>;
10
+ setEventSeriesAttendees(id: string, attendees: AttendeeInput[], context: ResolverContext): Promise<EventSeries>;
11
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventSeriesMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const attendee_type_1 = require("../attendee/attendee-type");
8
+ const event_1 = require("../event/event");
9
+ const event_series_1 = require("./event-series");
10
+ const event_series_service_1 = require("./event-series-service");
11
+ const event_series_type_1 = require("./event-series-type");
12
+ let EventSeriesMutation = class EventSeriesMutation {
13
+ createEventSeries(series, context) {
14
+ const { domain, user, tx } = context.state;
15
+ return (0, event_series_service_1.createEventSeries)(tx, domain, user, series);
16
+ }
17
+ updateEventSeries(id, patch, preview, context) {
18
+ const { domain, user, tx } = context.state;
19
+ return (0, event_series_service_1.updateEventSeries)(tx, domain, user, id, patch, { preview: !!preview });
20
+ }
21
+ deleteEventSeries(id, preview, context) {
22
+ const { domain, user, tx } = context.state;
23
+ return (0, event_series_service_1.deleteEventSeries)(tx, domain, user, id, { preview: !!preview });
24
+ }
25
+ generateEventOccurrences(id, until, context) {
26
+ const { domain, user, tx } = context.state;
27
+ return (0, event_series_service_1.generateEventOccurrences)(tx, domain, user, id, until);
28
+ }
29
+ setEventSeriesAttendees(id, attendees, context) {
30
+ const { domain, user, tx } = context.state;
31
+ return (0, event_series_service_1.setEventSeriesAttendees)(tx, domain, user, id, attendees);
32
+ }
33
+ };
34
+ exports.EventSeriesMutation = EventSeriesMutation;
35
+ tslib_1.__decorate([
36
+ (0, type_graphql_1.Directive)('@transaction'),
37
+ (0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
38
+ (0, type_graphql_1.Mutation)(returns => event_series_1.EventSeries, { description: 'To create a series; its occurrences are created by generateEventOccurrences' }),
39
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('series')),
40
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
41
+ tslib_1.__metadata("design:type", Function),
42
+ tslib_1.__metadata("design:paramtypes", [event_series_type_1.NewEventSeries, Object]),
43
+ tslib_1.__metadata("design:returntype", Promise)
44
+ ], EventSeriesMutation.prototype, "createEventSeries", null);
45
+ tslib_1.__decorate([
46
+ (0, type_graphql_1.Directive)('@transaction'),
47
+ (0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
48
+ (0, type_graphql_1.Mutation)(returns => event_series_type_1.EventSeriesChange, {
49
+ description: 'To change a series; its undecided occurrences from now on follow. With preview, only says what would change'
50
+ }),
51
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
52
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
53
+ tslib_1.__param(2, (0, type_graphql_1.Arg)('preview', { nullable: true })),
54
+ tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
55
+ tslib_1.__metadata("design:type", Function),
56
+ tslib_1.__metadata("design:paramtypes", [String, event_series_type_1.EventSeriesPatch, Boolean, Object]),
57
+ tslib_1.__metadata("design:returntype", Promise)
58
+ ], EventSeriesMutation.prototype, "updateEventSeries", null);
59
+ tslib_1.__decorate([
60
+ (0, type_graphql_1.Directive)('@transaction'),
61
+ (0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
62
+ (0, type_graphql_1.Mutation)(returns => event_series_type_1.EventSeriesChange, {
63
+ description: 'To delete a series with its undecided occurrences from now on. With preview, only says what would be removed'
64
+ }),
65
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
66
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('preview', { nullable: true })),
67
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
68
+ tslib_1.__metadata("design:type", Function),
69
+ tslib_1.__metadata("design:paramtypes", [String, Boolean, Object]),
70
+ tslib_1.__metadata("design:returntype", Promise)
71
+ ], EventSeriesMutation.prototype, "deleteEventSeries", null);
72
+ tslib_1.__decorate([
73
+ (0, type_graphql_1.Directive)('@transaction'),
74
+ (0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
75
+ (0, type_graphql_1.Mutation)(returns => [event_1.Event], { description: 'To create the occurrences of a series up to a time; asking twice makes each once' }),
76
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
77
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('until')),
78
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
79
+ tslib_1.__metadata("design:type", Function),
80
+ tslib_1.__metadata("design:paramtypes", [String, Date, Object]),
81
+ tslib_1.__metadata("design:returntype", Promise)
82
+ ], EventSeriesMutation.prototype, "generateEventOccurrences", null);
83
+ tslib_1.__decorate([
84
+ (0, type_graphql_1.Directive)('@transaction'),
85
+ (0, type_graphql_1.Directive)('@privilege(category: "calendar", privilege: "mutation", domainOwnerGranted: true)'),
86
+ (0, type_graphql_1.Mutation)(returns => event_series_1.EventSeries, {
87
+ description: 'To make the people named on a series exactly these; its undecided occurrences from now on follow. Naming grants nothing'
88
+ }),
89
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
90
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('attendees', type => [attendee_type_1.AttendeeInput])),
91
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
92
+ tslib_1.__metadata("design:type", Function),
93
+ tslib_1.__metadata("design:paramtypes", [String, Array, Object]),
94
+ tslib_1.__metadata("design:returntype", Promise)
95
+ ], EventSeriesMutation.prototype, "setEventSeriesAttendees", null);
96
+ exports.EventSeriesMutation = EventSeriesMutation = tslib_1.__decorate([
97
+ (0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals),
98
+ (0, type_graphql_1.Resolver)(event_series_1.EventSeries)
99
+ ], EventSeriesMutation);
100
+ //# sourceMappingURL=event-series-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-series-mutation.js","sourceRoot":"","sources":["../../../server/service/event-series/event-series-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAqF;AAErF,iDAAqD;AAErD,6DAAyD;AACzD,0CAAsC;AACtC,iDAA4C;AAC5C,iEAAmJ;AACnJ,2DAAyF;AAIlF,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAI9B,iBAAiB,CAAgB,MAAsB,EAAS,OAAwB;QACtF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,OAAO,IAAA,wCAAiB,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IACpD,CAAC;IAOD,iBAAiB,CACJ,EAAU,EACP,KAAuB,EACD,OAAgB,EAC7C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,OAAO,IAAA,wCAAiB,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;IAC/E,CAAC;IAOD,iBAAiB,CAAY,EAAU,EAAsC,OAAgB,EAAS,OAAwB;QAC5H,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,OAAO,IAAA,wCAAiB,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EA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AAC,qBAAa,CAAC;IAC5B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CAuD/B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver, UseMiddleware } from 'type-graphql'\n\nimport { SpeakRefusals } from '@things-factory/shell'\n\nimport { AttendeeInput } from '../attendee/attendee-type'\nimport { Event } from '../event/event'\nimport { EventSeries } from './event-series'\nimport { createEventSeries, deleteEventSeries, generateEventOccurrences, setEventSeriesAttendees, updateEventSeries } from './event-series-service'\nimport { EventSeriesChange, EventSeriesPatch, NewEventSeries } from './event-series-type'\n\n@UseMiddleware(SpeakRefusals)\n@Resolver(EventSeries)\nexport class EventSeriesMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => EventSeries, { description: 'To create a series; its occurrences are created by generateEventOccurrences' })\n createEventSeries(@Arg('series') series: NewEventSeries, @Ctx() context: ResolverContext): Promise<EventSeries> {\n const { domain, user, tx } = context.state\n return createEventSeries(tx, domain, user, series)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => EventSeriesChange, {\n description: 'To change a series; its undecided occurrences from now on follow. With preview, only says what would change'\n })\n updateEventSeries(\n @Arg('id') id: string,\n @Arg('patch') patch: EventSeriesPatch,\n @Arg('preview', { nullable: true }) preview: boolean,\n @Ctx() context: ResolverContext\n ): Promise<EventSeriesChange> {\n const { domain, user, tx } = context.state\n return updateEventSeries(tx, domain, user, id, patch, { preview: !!preview })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => EventSeriesChange, {\n description: 'To delete a series with its undecided occurrences from now on. With preview, only says what would be removed'\n })\n deleteEventSeries(@Arg('id') id: string, @Arg('preview', { nullable: true }) preview: boolean, @Ctx() context: ResolverContext): Promise<EventSeriesChange> {\n const { domain, user, tx } = context.state\n return deleteEventSeries(tx, domain, user, id, { preview: !!preview })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Event], { description: 'To create the occurrences of a series up to a time; asking twice makes each once' })\n generateEventOccurrences(@Arg('id') id: string, @Arg('until') until: Date, @Ctx() context: ResolverContext): Promise<Event[]> {\n const { domain, user, tx } = context.state\n return generateEventOccurrences(tx, domain, user, id, until)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"calendar\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => EventSeries, {\n description: 'To make the people named on a series exactly these; its undecided occurrences from now on follow. Naming grants nothing'\n })\n setEventSeriesAttendees(\n @Arg('id') id: string,\n @Arg('attendees', type => [AttendeeInput]) attendees: AttendeeInput[],\n @Ctx() context: ResolverContext\n ): Promise<EventSeries> {\n const { domain, user, tx } = context.state\n return setEventSeriesAttendees(tx, domain, user, id, attendees)\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain, ListParam } from '@things-factory/shell';
3
+ import { Attendee } from '../attendee/attendee';
4
+ import { Calendar } from '../calendar/calendar';
5
+ import { EventSeries } from './event-series';
6
+ import { EventSeriesList } from './event-series-type';
7
+ export declare class EventSeriesQuery {
8
+ eventSeries(id: string, context: ResolverContext): Promise<EventSeries>;
9
+ eventSeriesList(params: ListParam, context: ResolverContext): Promise<EventSeriesList>;
10
+ attendees(series: EventSeries): Promise<Attendee[]>;
11
+ calendar(series: EventSeries): Promise<Calendar>;
12
+ organizer(series: EventSeries): Promise<User>;
13
+ domain(series: EventSeries): Promise<Domain>;
14
+ updater(series: EventSeries): Promise<User>;
15
+ creator(series: EventSeries): Promise<User>;
16
+ }