@stamhoofd/models 2.79.7 → 2.80.0

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 (76) hide show
  1. package/dist/src/factories/EmailTemplateFactory.d.ts +18 -0
  2. package/dist/src/factories/EmailTemplateFactory.d.ts.map +1 -0
  3. package/dist/src/factories/EmailTemplateFactory.js +43 -0
  4. package/dist/src/factories/EmailTemplateFactory.js.map +1 -0
  5. package/dist/src/factories/EventFactory.d.ts +17 -0
  6. package/dist/src/factories/EventFactory.d.ts.map +1 -0
  7. package/dist/src/factories/EventFactory.js +30 -0
  8. package/dist/src/factories/EventFactory.js.map +1 -0
  9. package/dist/src/factories/EventNotificationFactory.d.ts +21 -0
  10. package/dist/src/factories/EventNotificationFactory.d.ts.map +1 -0
  11. package/dist/src/factories/EventNotificationFactory.js +44 -0
  12. package/dist/src/factories/EventNotificationFactory.js.map +1 -0
  13. package/dist/src/factories/EventNotificationTypeFactory.d.ts +11 -0
  14. package/dist/src/factories/EventNotificationTypeFactory.d.ts.map +1 -0
  15. package/dist/src/factories/EventNotificationTypeFactory.js +25 -0
  16. package/dist/src/factories/EventNotificationTypeFactory.js.map +1 -0
  17. package/dist/src/factories/PlatformEventTypeFactory.d.ts +10 -0
  18. package/dist/src/factories/PlatformEventTypeFactory.d.ts.map +1 -0
  19. package/dist/src/factories/PlatformEventTypeFactory.js +23 -0
  20. package/dist/src/factories/PlatformEventTypeFactory.js.map +1 -0
  21. package/dist/src/factories/RecordAnswerFactory.d.ts +17 -0
  22. package/dist/src/factories/RecordAnswerFactory.d.ts.map +1 -0
  23. package/dist/src/factories/RecordAnswerFactory.js +95 -0
  24. package/dist/src/factories/RecordAnswerFactory.js.map +1 -0
  25. package/dist/src/factories/RecordCategoryFactory.d.ts +11 -0
  26. package/dist/src/factories/RecordCategoryFactory.d.ts.map +1 -0
  27. package/dist/src/factories/RecordCategoryFactory.js +23 -0
  28. package/dist/src/factories/RecordCategoryFactory.js.map +1 -0
  29. package/dist/src/factories/RecordFactory.d.ts +7 -6
  30. package/dist/src/factories/RecordFactory.d.ts.map +1 -1
  31. package/dist/src/factories/RecordFactory.js +10 -4
  32. package/dist/src/factories/RecordFactory.js.map +1 -1
  33. package/dist/src/factories/RegistrationPeriodFactory.d.ts +1 -0
  34. package/dist/src/factories/RegistrationPeriodFactory.d.ts.map +1 -1
  35. package/dist/src/factories/RegistrationPeriodFactory.js +2 -0
  36. package/dist/src/factories/RegistrationPeriodFactory.js.map +1 -1
  37. package/dist/src/factories/index.d.ts +7 -0
  38. package/dist/src/factories/index.d.ts.map +1 -1
  39. package/dist/src/factories/index.js +7 -0
  40. package/dist/src/factories/index.js.map +1 -1
  41. package/dist/src/helpers/DNSValidator.d.ts.map +1 -1
  42. package/dist/src/helpers/DNSValidator.js +57 -55
  43. package/dist/src/helpers/DNSValidator.js.map +1 -1
  44. package/dist/src/helpers/EmailBuilder.d.ts.map +1 -1
  45. package/dist/src/helpers/EmailBuilder.js +2 -1
  46. package/dist/src/helpers/EmailBuilder.js.map +1 -1
  47. package/dist/src/migrations/1741954610-event-notifications-accepted-record-answers.sql +2 -0
  48. package/dist/src/migrations/1742393831-default-template-partially-accepted-event-notification.sql +2 -0
  49. package/dist/src/migrations/1742579832-audit-log-longer-object-size.sql +3 -0
  50. package/dist/src/models/EventNotification.d.ts +4 -0
  51. package/dist/src/models/EventNotification.d.ts.map +1 -1
  52. package/dist/src/models/EventNotification.js +7 -0
  53. package/dist/src/models/EventNotification.js.map +1 -1
  54. package/dist/src/models/Organization.d.ts +1 -0
  55. package/dist/src/models/Organization.d.ts.map +1 -1
  56. package/dist/src/models/Organization.js +13 -4
  57. package/dist/src/models/Organization.js.map +1 -1
  58. package/dist/tsconfig.tsbuildinfo +1 -1
  59. package/package.json +2 -2
  60. package/src/factories/EmailTemplateFactory.ts +47 -0
  61. package/src/factories/EventFactory.ts +31 -0
  62. package/src/factories/EventNotificationFactory.ts +51 -0
  63. package/src/factories/EventNotificationTypeFactory.ts +26 -0
  64. package/src/factories/PlatformEventTypeFactory.ts +23 -0
  65. package/src/factories/RecordAnswerFactory.ts +113 -0
  66. package/src/factories/RecordCategoryFactory.ts +23 -0
  67. package/src/factories/RecordFactory.ts +14 -8
  68. package/src/factories/RegistrationPeriodFactory.ts +2 -0
  69. package/src/factories/index.ts +7 -0
  70. package/src/helpers/DNSValidator.ts +62 -56
  71. package/src/helpers/EmailBuilder.ts +2 -1
  72. package/src/migrations/1741954610-event-notifications-accepted-record-answers.sql +2 -0
  73. package/src/migrations/1742393831-default-template-partially-accepted-event-notification.sql +2 -0
  74. package/src/migrations/1742579832-audit-log-longer-object-size.sql +3 -0
  75. package/src/models/EventNotification.ts +6 -0
  76. package/src/models/Organization.ts +15 -5
@@ -0,0 +1,18 @@
1
+ import { Factory } from '@simonbackx/simple-database';
2
+ import { EmailTemplate } from '../models';
3
+ import { Organization } from '../models/Organization';
4
+ import { EmailTemplateType } from '@stamhoofd/structures';
5
+ declare class Options {
6
+ organization?: Organization;
7
+ groupId?: string;
8
+ webshopId?: string;
9
+ type: EmailTemplateType;
10
+ subject?: string;
11
+ html?: string;
12
+ text?: string;
13
+ }
14
+ export declare class EmailTemplateFactory extends Factory<Options, EmailTemplate> {
15
+ create(): Promise<EmailTemplate>;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=EmailTemplateFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailTemplateFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/EmailTemplateFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAwC,MAAM,uBAAuB,CAAC;AAEhG,cAAM,OAAO;IACT,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,iBAAiB,CAAC;IAExB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC;IAC/D,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC;CA4BzC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmailTemplateFactory = void 0;
4
+ const simple_database_1 = require("@simonbackx/simple-database");
5
+ const models_1 = require("../models");
6
+ const structures_1 = require("@stamhoofd/structures");
7
+ class Options {
8
+ organization;
9
+ groupId;
10
+ webshopId;
11
+ type;
12
+ subject;
13
+ html;
14
+ text;
15
+ }
16
+ class EmailTemplateFactory extends simple_database_1.Factory {
17
+ async create() {
18
+ const template = new models_1.EmailTemplate();
19
+ template.organizationId = this.options.organization?.id ?? null;
20
+ template.groupId = this.options.groupId ?? null;
21
+ template.webshopId = this.options.webshopId ?? null;
22
+ template.type = this.options.type;
23
+ template.subject = this.options.subject ?? this.options.type;
24
+ template.json = {};
25
+ template.html = '';
26
+ template.text = '';
27
+ if (this.options.html || this.options.text) {
28
+ template.html = this.options.html ?? '<p></p>';
29
+ template.text = this.options.text ?? 'Text';
30
+ }
31
+ else {
32
+ // Automatically add all replacements in our template email
33
+ for (const replacement of structures_1.EmailTemplate.getSupportedReplacementsForType(this.options.type)) {
34
+ template.html += `<p>${replacement.token}: {{${replacement.token}}}</p>`;
35
+ template.text += `${replacement.token}: {{${replacement.token}}}\n`;
36
+ }
37
+ }
38
+ await template.save();
39
+ return template;
40
+ }
41
+ }
42
+ exports.EmailTemplateFactory = EmailTemplateFactory;
43
+ //# sourceMappingURL=EmailTemplateFactory.js.map
@@ -0,0 +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ACF,2DAA2D;YAC3D,KAAK,MAAM,WAAW,IAAI,0BAAmB,CAAC,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/F,QAAQ,CAAC,IAAI,IAAI,MAAM,WAAW,CAAC,KAAK,OAAO,WAAW,CAAC,KAAK,QAAQ,CAAC;gBACzE,QAAQ,CAAC,IAAI,IAAI,GAAG,WAAW,CAAC,KAAK,OAAO,WAAW,CAAC,KAAK,MAAM,CAAC;YACxE,CAAC;QACL,CAAC;QAED,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AA7BD,oDA6BC"}
@@ -0,0 +1,17 @@
1
+ import { Factory } from '@simonbackx/simple-database';
2
+ import { EventMeta } from '@stamhoofd/structures';
3
+ import { Event } from '../models/Event';
4
+ import { Organization } from '../models/Organization';
5
+ declare class Options {
6
+ organization?: Organization;
7
+ name?: string;
8
+ meta?: EventMeta;
9
+ startDate?: Date;
10
+ endDate?: Date;
11
+ typeId?: string;
12
+ }
13
+ export declare class EventFactory extends Factory<Options, Event> {
14
+ create(): Promise<Event>;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=EventFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/EventFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,cAAM,OAAO;IACT,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,YAAa,SAAQ,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC;IAC/C,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;CAajC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventFactory = void 0;
4
+ const simple_database_1 = require("@simonbackx/simple-database");
5
+ const structures_1 = require("@stamhoofd/structures");
6
+ const Event_1 = require("../models/Event");
7
+ const PlatformEventTypeFactory_1 = require("./PlatformEventTypeFactory");
8
+ class Options {
9
+ organization;
10
+ name;
11
+ meta;
12
+ startDate;
13
+ endDate;
14
+ typeId;
15
+ }
16
+ class EventFactory extends simple_database_1.Factory {
17
+ async create() {
18
+ const event = new Event_1.Event();
19
+ event.organizationId = this.options.organization?.id ?? null;
20
+ event.typeId = this.options.typeId ?? (await new PlatformEventTypeFactory_1.PlatformEventTypeFactory({}).create()).id;
21
+ event.startDate = this.options.startDate ?? new Date(Date.now() + 5 * 24 * 60 * 60 * 1000);
22
+ event.endDate = this.options.endDate ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);
23
+ event.name = this.options.name ?? 'Event ' + (new Date().getTime() + Math.floor(Math.random() * 999999));
24
+ event.meta = this.options.meta ?? structures_1.EventMeta.create({});
25
+ await event.save();
26
+ return event;
27
+ }
28
+ }
29
+ exports.EventFactory = EventFactory;
30
+ //# sourceMappingURL=EventFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventFactory.js","sourceRoot":"","sources":["../../../src/factories/EventFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAAkD;AAElD,2CAAwC;AAExC,yEAAsE;AAEtE,MAAM,OAAO;IACT,YAAY,CAAgB;IAC5B,IAAI,CAAU;IACd,IAAI,CAAa;IACjB,SAAS,CAAQ;IACjB,OAAO,CAAQ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from '@stamhoofd/structures';
3
+ import { EventNotification, User } from '../models';
4
+ import { Event } from '../models/Event';
5
+ import { Organization } from '../models/Organization';
6
+ declare class Options {
7
+ organization: Organization;
8
+ events?: Event[];
9
+ typeId?: string;
10
+ status?: EventNotificationStatus;
11
+ feedbackText?: string;
12
+ periodId?: string;
13
+ recordAnswers?: Map<string, RecordAnswer>;
14
+ acceptedRecordAnswers?: Map<string, RecordAnswer>;
15
+ submittedBy?: User | null;
16
+ }
17
+ export declare class EventNotificationFactory extends Factory<Options, EventNotification> {
18
+ create(): Promise<EventNotification>;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=EventNotificationFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventNotificationFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/EventNotificationFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAItD,cAAM,OAAO;IACT,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1C,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC7B;AAED,qBAAa,wBAAyB,SAAQ,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACvE,MAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC;CA4B7C"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventNotificationFactory = void 0;
4
+ const simple_database_1 = require("@simonbackx/simple-database");
5
+ const structures_1 = require("@stamhoofd/structures");
6
+ const models_1 = require("../models");
7
+ const EventFactory_1 = require("./EventFactory");
8
+ const EventNotificationTypeFactory_1 = require("./EventNotificationTypeFactory");
9
+ class Options {
10
+ organization;
11
+ events;
12
+ typeId;
13
+ status;
14
+ feedbackText;
15
+ periodId;
16
+ recordAnswers;
17
+ acceptedRecordAnswers;
18
+ submittedBy;
19
+ }
20
+ class EventNotificationFactory extends simple_database_1.Factory {
21
+ async create() {
22
+ const eventNotification = new models_1.EventNotification();
23
+ eventNotification.organizationId = this.options.organization.id;
24
+ eventNotification.typeId = this.options.typeId ?? (await new EventNotificationTypeFactory_1.EventNotificationTypeFactory({}).create()).id;
25
+ eventNotification.status = this.options.status ?? structures_1.EventNotificationStatus.Draft;
26
+ eventNotification.createdBy = null;
27
+ eventNotification.feedbackText = this.options.feedbackText ?? null;
28
+ const events = this.options.events ?? [await new EventFactory_1.EventFactory({ organization: this.options.organization }).create()];
29
+ eventNotification.startDate = events[0].startDate;
30
+ eventNotification.endDate = events[0].endDate;
31
+ eventNotification.periodId = this.options.periodId ?? this.options.organization.periodId;
32
+ // Set record answers
33
+ eventNotification.recordAnswers = this.options.recordAnswers ?? new Map();
34
+ eventNotification.acceptedRecordAnswers = this.options.acceptedRecordAnswers ?? new Map();
35
+ eventNotification.submittedBy = this.options.submittedBy?.id ?? null;
36
+ eventNotification.submittedAt = this.options.submittedBy ? new Date() : null;
37
+ await eventNotification.save();
38
+ // Link events
39
+ await models_1.EventNotification.events.link(eventNotification, events);
40
+ return eventNotification;
41
+ }
42
+ }
43
+ exports.EventNotificationFactory = EventNotificationFactory;
44
+ //# sourceMappingURL=EventNotificationFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventNotificationFactory.js","sourceRoot":"","sources":["../../../src/factories/EventNotificationFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAA8E;AAE9E,sCAAoD;AAGpD,iDAA8C;AAC9C,iFAA8E;AAE9E,MAAM,OAAO;IACT,YAAY,CAAe;IAC3B,MAAM,CAAW;IACjB,MAAM,CAAU;IAChB,MAAM,CAA2B;IACjC,YAAY,CAAU;IACtB,QAAQ,CAAU;IAClB,aAAa,CAA6B;IAC1C,qBAAqB,CAA6B;IAClD,WAAW,CAAe;CAC7B;AAED,MAAa,wBAAyB,SAAQ,yBAAmC;IAC7E,KAAK,CAAC,MAAM;QACR,MAAM,iBAAiB,GAAG,IAAI,0BAAiB,EAAE,CAAC;QAElD,iBAAiB,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,IAAI,2DAA4B,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;QAC3G,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,oCAAuB,CAAC,KAAK,CAAC;QAChF,iBAAiB,CAAC,SAAS,GAAG,IAAI,CAAC;QACnC,iBAAiB,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;QAEnE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,IAAI,2BAAY,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAErH,iBAAiB,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClD,iBAAiB,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9C,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC;QAEzF,qBAAqB;QACrB,iBAAiB,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,IAAI,GAAG,EAAE,CAAC;QAC1E,iBAAiB,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,IAAI,IAAI,GAAG,EAAE,CAAC;QAE1F,iBAAiB,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,IAAI,CAAC;QACrE,iBAAiB,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAE7E,MAAM,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAE/B,cAAc;QACd,MAAM,0BAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAC/D,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ;AA7BD,4DA6BC"}
@@ -0,0 +1,11 @@
1
+ import { Factory } from '@simonbackx/simple-database';
2
+ import { EventNotificationType, RecordCategory } from '@stamhoofd/structures';
3
+ declare class Options {
4
+ title?: string;
5
+ recordCategories?: RecordCategory[];
6
+ }
7
+ export declare class EventNotificationTypeFactory extends Factory<Options, EventNotificationType> {
8
+ create(): Promise<EventNotificationType>;
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=EventNotificationTypeFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventNotificationTypeFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/EventNotificationTypeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI9E,cAAM,OAAO;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;CACvC;AAED,qBAAa,4BAA6B,SAAQ,OAAO,CAAC,OAAO,EAAE,qBAAqB,CAAC;IAC/E,MAAM,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAcjD"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventNotificationTypeFactory = void 0;
4
+ const simple_database_1 = require("@simonbackx/simple-database");
5
+ const structures_1 = require("@stamhoofd/structures");
6
+ const Platform_1 = require("../models/Platform");
7
+ class Options {
8
+ title;
9
+ recordCategories;
10
+ }
11
+ class EventNotificationTypeFactory extends simple_database_1.Factory {
12
+ async create() {
13
+ const eventType = structures_1.EventNotificationType.create({
14
+ title: this.options.title ?? ('Melding ' + (new Date().getTime() + Math.floor(Math.random() * 999999))),
15
+ });
16
+ eventType.recordCategories = this.options.recordCategories ?? [];
17
+ // Add to platform
18
+ const platform = await Platform_1.Platform.getForEditing();
19
+ platform.config.eventNotificationTypes.push(eventType);
20
+ await platform.save();
21
+ return eventType;
22
+ }
23
+ }
24
+ exports.EventNotificationTypeFactory = EventNotificationTypeFactory;
25
+ //# sourceMappingURL=EventNotificationTypeFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventNotificationTypeFactory.js","sourceRoot":"","sources":["../../../src/factories/EventNotificationTypeFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAA8E;AAE9E,iDAA8C;AAE9C,MAAM,OAAO;IACT,KAAK,CAAU;IACf,gBAAgB,CAAoB;CACvC;AAED,MAAa,4BAA6B,SAAQ,yBAAuC;IACrF,KAAK,CAAC,MAAM;QACR,MAAM,SAAS,GAAG,kCAAqB,CAAC,MAAM,CAAC;YAC3C,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;SAC1G,CAAC,CAAC;QAEH,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;QAEjE,kBAAkB;QAClB,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,aAAa,EAAE,CAAC;QAChD,QAAQ,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvD,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEtB,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAfD,oEAeC"}
@@ -0,0 +1,10 @@
1
+ import { Factory } from '@simonbackx/simple-database';
2
+ import { PlatformEventType } from '@stamhoofd/structures';
3
+ declare class Options {
4
+ name?: string;
5
+ }
6
+ export declare class PlatformEventTypeFactory extends Factory<Options, PlatformEventType> {
7
+ create(): Promise<PlatformEventType>;
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=PlatformEventTypeFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformEventTypeFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/PlatformEventTypeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,cAAM,OAAO;IACT,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,wBAAyB,SAAQ,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACvE,MAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAY7C"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatformEventTypeFactory = void 0;
4
+ const simple_database_1 = require("@simonbackx/simple-database");
5
+ const structures_1 = require("@stamhoofd/structures");
6
+ const Platform_1 = require("../models/Platform");
7
+ class Options {
8
+ name;
9
+ }
10
+ class PlatformEventTypeFactory extends simple_database_1.Factory {
11
+ async create() {
12
+ const eventType = structures_1.PlatformEventType.create({
13
+ name: this.options.name ?? ('Responsibility ' + (new Date().getTime() + Math.floor(Math.random() * 999999))),
14
+ });
15
+ // Add to platform
16
+ const platform = await Platform_1.Platform.getForEditing();
17
+ platform.config.eventTypes.push(eventType);
18
+ await platform.save();
19
+ return eventType;
20
+ }
21
+ }
22
+ exports.PlatformEventTypeFactory = PlatformEventTypeFactory;
23
+ //# sourceMappingURL=PlatformEventTypeFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformEventTypeFactory.js","sourceRoot":"","sources":["../../../src/factories/PlatformEventTypeFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAA0D;AAE1D,iDAA8C;AAE9C,MAAM,OAAO;IACT,IAAI,CAAU;CACjB;AAED,MAAa,wBAAyB,SAAQ,yBAAmC;IAC7E,KAAK,CAAC,MAAM;QACR,MAAM,SAAS,GAAG,8BAAiB,CAAC,MAAM,CAAC;YACvC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,iBAAiB,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;SAC/G,CAAC,CAAC;QAEH,kBAAkB;QAClB,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,aAAa,EAAE,CAAC;QAChD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3C,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEtB,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAbD,4DAaC"}
@@ -0,0 +1,17 @@
1
+ import { Factory } from '@simonbackx/simple-database';
2
+ import { RecordAnswer, RecordCategory, RecordSettings } from '@stamhoofd/structures';
3
+ type Options = ({
4
+ records: RecordSettings[];
5
+ } | {
6
+ recordCategories: RecordCategory[];
7
+ }) & {
8
+ /**
9
+ * Defaults to true
10
+ */
11
+ complete?: boolean;
12
+ };
13
+ export declare class RecordAnswerFactory extends Factory<Options, Map<string, RecordAnswer>> {
14
+ create(): Promise<Map<string, RecordAnswer>>;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=RecordAnswerFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordAnswerFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/RecordAnswerFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAoC,YAAY,EAAE,cAAc,EAA0K,cAAc,EAAgC,MAAM,uBAAuB,CAAC;AAG7T,KAAK,OAAO,GAAG,CAAC;IACZ,OAAO,EAAE,cAAc,EAAE,CAAC;CAC7B,GAAG;IACA,gBAAgB,EAAE,cAAc,EAAE,CAAC;CACtC,CAAC,GAAG;IACD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,qBAAa,mBAAoB,SAAQ,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1E,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAgGrD"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordAnswerFactory = void 0;
4
+ const simple_database_1 = require("@simonbackx/simple-database");
5
+ const structures_1 = require("@stamhoofd/structures");
6
+ const AddressFactory_1 = require("./AddressFactory");
7
+ class RecordAnswerFactory extends simple_database_1.Factory {
8
+ async create() {
9
+ const records = 'records' in this.options ? this.options.records : this.options.recordCategories.flatMap(c => c.getAllRecords());
10
+ const map = new Map();
11
+ for (const record of records) {
12
+ const answer = structures_1.RecordAnswer.createDefaultAnswer(record);
13
+ if (this.options.complete !== false) {
14
+ // Make sure it is filled in
15
+ answer.markReviewed();
16
+ switch (true) {
17
+ case answer instanceof structures_1.RecordCheckboxAnswer: {
18
+ // If it is a checkbox, set the first one to true
19
+ answer.selected = true;
20
+ break;
21
+ }
22
+ case answer instanceof structures_1.RecordTextAnswer: {
23
+ answer.value = 'Test ' + Math.floor(Math.random() * 100000);
24
+ switch (record.type) {
25
+ case structures_1.RecordType.Phone: {
26
+ answer.value = '+32 477 77 77 77';
27
+ break;
28
+ }
29
+ case structures_1.RecordType.Email: {
30
+ answer.value = 'example@example.domain';
31
+ break;
32
+ }
33
+ case structures_1.RecordType.Textarea: {
34
+ answer.value = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nVivamus lacinia odio vitae vestibulum.';
35
+ break;
36
+ }
37
+ }
38
+ break;
39
+ }
40
+ case answer instanceof structures_1.RecordMultipleChoiceAnswer:
41
+ {
42
+ // If it is a multiple choice, select all
43
+ answer.selectedChoices = record.choices.map(c => c.clone());
44
+ break;
45
+ }
46
+ ;
47
+ case answer instanceof structures_1.RecordChooseOneAnswer:
48
+ {
49
+ // Select first
50
+ answer.selectedChoice = record.choices[0]?.clone() ?? null;
51
+ break;
52
+ }
53
+ ;
54
+ case answer instanceof structures_1.RecordAddressAnswer: {
55
+ answer.address = await new AddressFactory_1.AddressFactory({}).create();
56
+ break;
57
+ }
58
+ case answer instanceof structures_1.RecordDateAnswer: {
59
+ answer.dateValue = new Date();
60
+ break;
61
+ }
62
+ case answer instanceof structures_1.RecordPriceAnswer: {
63
+ answer.value = 1234;
64
+ break;
65
+ }
66
+ case answer instanceof structures_1.RecordImageAnswer: {
67
+ answer.image = structures_1.Image.create({});
68
+ break;
69
+ }
70
+ case answer instanceof structures_1.RecordIntegerAnswer: {
71
+ answer.value = 5;
72
+ break;
73
+ }
74
+ case answer instanceof structures_1.RecordFileAnswer: {
75
+ answer.file = new structures_1.File({
76
+ id: 'example-id',
77
+ server: 'https://example.domain',
78
+ path: 'example/path/to/file',
79
+ size: 1234,
80
+ name: 'example.txt',
81
+ isPrivate: false,
82
+ signedUrl: null,
83
+ signature: null,
84
+ });
85
+ break;
86
+ }
87
+ }
88
+ }
89
+ map.set(record.id, answer);
90
+ }
91
+ return map;
92
+ }
93
+ }
94
+ exports.RecordAnswerFactory = RecordAnswerFactory;
95
+ //# sourceMappingURL=RecordAnswerFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordAnswerFactory.js","sourceRoot":"","sources":["../../../src/factories/RecordAnswerFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAA6T;AAC7T,qDAAkD;AAalD,MAAa,mBAAoB,SAAQ,yBAA2C;IAChF,KAAK,CAAC,MAAM;QACR,MAAM,OAAO,GAAG,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;QAEjI,MAAM,GAAG,GAA8B,IAAI,GAAG,EAAE,CAAC;QAEjD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,yBAAY,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YAExD,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;gBAClC,4BAA4B;gBAC5B,MAAM,CAAC,YAAY,EAAE,CAAC;g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database';
2
+ import { RecordCategory } from '@stamhoofd/structures';
3
+ import { RecordOptions } from './RecordFactory';
4
+ declare class Options {
5
+ records: RecordOptions[];
6
+ }
7
+ export declare class RecordCategoryFactory extends Factory<Options, RecordCategory> {
8
+ create(): Promise<RecordCategory>;
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=RecordCategoryFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordCategoryFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/RecordCategoryFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,cAAc,EAA8B,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE/D,cAAM,OAAO;IACT,OAAO,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC;IACjE,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;CAa1C"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordCategoryFactory = void 0;
4
+ const simple_database_1 = require("@simonbackx/simple-database");
5
+ const structures_1 = require("@stamhoofd/structures");
6
+ const RecordFactory_1 = require("./RecordFactory");
7
+ class Options {
8
+ records;
9
+ }
10
+ class RecordCategoryFactory extends simple_database_1.Factory {
11
+ async create() {
12
+ const records = [];
13
+ for (const record of this.options.records) {
14
+ records.push(await new RecordFactory_1.RecordFactory(record).create());
15
+ }
16
+ return structures_1.RecordCategory.create({
17
+ name: 'Record category ' + Math.floor(Math.random() * 10000),
18
+ records,
19
+ });
20
+ }
21
+ }
22
+ exports.RecordCategoryFactory = RecordCategoryFactory;
23
+ //# sourceMappingURL=RecordCategoryFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordCategoryFactory.js","sourceRoot":"","sources":["../../../src/factories/RecordCategoryFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAAmF;AACnF,mDAA+D;AAE/D,MAAM,OAAO;IACT,OAAO,CAAkB;CAC5B;AAED,MAAa,qBAAsB,SAAQ,yBAAgC;IACvE,KAAK,CAAC,MAAM;QACR,MAAM,OAAO,GAAqB,EAAE,CAAC;QACrC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACxC,OAAO,CAAC,IAAI,CACR,MAAM,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAC3C,CAAC;QACN,CAAC;QAED,OAAO,2BAAc,CAAC,MAAM,CAAC;YACzB,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;YAC5D,OAAO;SACV,CAAC,CAAC;IACP,CAAC;CACJ;AAdD,sDAcC"}
@@ -1,9 +1,10 @@
1
1
  import { Factory } from '@simonbackx/simple-database';
2
- import { LegacyRecord } from '@stamhoofd/structures';
3
- type Options = Record<string, never>;
4
- export declare class RecordFactory extends Factory<Options, LegacyRecord> {
5
- LegacyRecordLegacyRecord: any;
6
- create(): Promise<LegacyRecord>;
2
+ import { RecordSettings, RecordType } from '@stamhoofd/structures';
3
+ export declare class RecordOptions {
4
+ type: RecordType;
5
+ required?: boolean;
6
+ }
7
+ export declare class RecordFactory extends Factory<RecordOptions, RecordSettings> {
8
+ create(): Promise<RecordSettings>;
7
9
  }
8
- export {};
9
10
  //# sourceMappingURL=RecordFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecordFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/RecordFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAoB,MAAM,uBAAuB,CAAC;AAEvE,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAErC,qBAAa,aAAc,SAAQ,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC;IAC7D,wBAAwB,MAAC;IACzB,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;CAKlC"}
1
+ {"version":3,"file":"RecordFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/RecordFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnE,qBAAa,aAAa;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,qBAAa,aAAc,SAAQ,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC;IACrE,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;CASpC"}
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecordFactory = void 0;
3
+ exports.RecordFactory = exports.RecordOptions = void 0;
4
4
  const simple_database_1 = require("@simonbackx/simple-database");
5
5
  const structures_1 = require("@stamhoofd/structures");
6
+ class RecordOptions {
7
+ type;
8
+ required;
9
+ }
10
+ exports.RecordOptions = RecordOptions;
6
11
  class RecordFactory extends simple_database_1.Factory {
7
- LegacyRecordLegacyRecord;
8
12
  create() {
9
- return Promise.resolve(structures_1.LegacyRecord.create({
10
- type: this.randomArray(Object.values(structures_1.LegacyRecordType)),
13
+ return Promise.resolve(structures_1.RecordSettings.create({
14
+ name: 'Record name ' + Math.floor(Math.random() * 10000),
15
+ type: this.options.type,
16
+ required: this.options.required ?? (this.options.type !== structures_1.RecordType.Checkbox),
11
17
  }));
12
18
  }
13
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RecordFactory.js","sourceRoot":"","sources":["../../../src/factories/RecordFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAAuE;AAIvE,MAAa,aAAc,SAAQ,yBAA8B;IAC7D,wBAAwB,CAAC;IACzB,MAAM;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,yBAAY,CAAC,MAAM,CAAC;YACvC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,6BAAgB,CAAC,CAAC;SAC1D,CAAC,CAAC,CAAC;IACR,CAAC;CACJ;AAPD,sCAOC"}
1
+ {"version":3,"file":"RecordFactory.js","sourceRoot":"","sources":["../../../src/factories/RecordFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAAmE;AAEnE,MAAa,aAAa;IACtB,IAAI,CAAa;IACjB,QAAQ,CAAW;CACtB;AAHD,sCAGC;AAED,MAAa,aAAc,SAAQ,yBAAsC;IACrE,MAAM;QACF,OAAO,OAAO,CAAC,OAAO,CAClB,2BAAc,CAAC,MAAM,CAAC;YAClB,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;YACxD,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,uBAAU,CAAC,QAAQ,CAAC;SACjF,CAAC,CACL,CAAC;IACN,CAAC;CACJ;AAVD,sCAUC"}
@@ -4,6 +4,7 @@ declare class Options {
4
4
  startDate?: Date;
5
5
  endDate?: Date;
6
6
  previousPeriodId?: string;
7
+ locked?: boolean;
7
8
  }
8
9
  export declare class RegistrationPeriodFactory extends Factory<Options, RegistrationPeriod> {
9
10
  create(): Promise<RegistrationPeriod>;
@@ -1 +1 @@
1
- {"version":3,"file":"RegistrationPeriodFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/RegistrationPeriodFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,cAAM,OAAO;IACT,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,qBAAa,yBAA0B,SAAQ,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACzE,MAAM,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAc9C"}
1
+ {"version":3,"file":"RegistrationPeriodFactory.d.ts","sourceRoot":"","sources":["../../../src/factories/RegistrationPeriodFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,cAAM,OAAO;IACT,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,yBAA0B,SAAQ,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACzE,MAAM,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAe9C"}
@@ -8,6 +8,7 @@ class Options {
8
8
  startDate;
9
9
  endDate;
10
10
  previousPeriodId;
11
+ locked;
11
12
  }
12
13
  class RegistrationPeriodFactory extends simple_database_1.Factory {
13
14
  async create() {
@@ -19,6 +20,7 @@ class RegistrationPeriodFactory extends simple_database_1.Factory {
19
20
  period.previousPeriodId = this.options.previousPeriodId;
20
21
  }
21
22
  period.settings = structures_1.RegistrationPeriodSettings.create({});
23
+ period.locked = this.options.locked ?? false;
22
24
  await period.save();
23
25
  return period;
24
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RegistrationPeriodFactory.js","sourceRoot":"","sources":["../../../src/factories/RegistrationPeriodFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAAmE;AAEnE,sCAA+C;AAE/C,MAAM,OAAO;IACT,SAAS,CAAQ;IACjB,OAAO,CAAQ;IACf,gBAAgB,CAAU;CAC7B;AAED,MAAa,yBAA0B,SAAQ,yBAAoC;IAC/E,KAAK,CAAC,MAAM;QACR,MAAM,MAAM,GAAG,IAAI,2BAAkB,EAAE,CAAC;QAExC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9E,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QACjF,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAChC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;QAC5D,CAAC;QACD,MAAM,CAAC,QAAQ,GAAG,uCAA0B,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAExD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAfD,8DAeC"}
1
+ {"version":3,"file":"RegistrationPeriodFactory.js","sourceRoot":"","sources":["../../../src/factories/RegistrationPeriodFactory.ts"],"names":[],"mappings":";;;AAAA,iEAAsD;AACtD,sDAAmE;AAEnE,sCAA+C;AAE/C,MAAM,OAAO;IACT,SAAS,CAAQ;IACjB,OAAO,CAAQ;IACf,gBAAgB,CAAU;IAC1B,MAAM,CAAW;CACpB;AAED,MAAa,yBAA0B,SAAQ,yBAAoC;IAC/E,KAAK,CAAC,MAAM;QACR,MAAM,MAAM,GAAG,IAAI,2BAAkB,EAAE,CAAC;QAExC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9E,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QACjF,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAChC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;QAC5D,CAAC;QACD,MAAM,CAAC,QAAQ,GAAG,uCAA0B,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;QAE7C,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAhBD,8DAgBC"}
@@ -15,4 +15,11 @@ export * from './OrganizationTagFactory';
15
15
  export * from './OrganizationRegistrationPeriodFactory';
16
16
  export * from './MemberResponsibilityRecordFactory';
17
17
  export * from './PlatformResponsibilityFactory';
18
+ export * from './PlatformEventTypeFactory';
19
+ export * from './EventFactory';
20
+ export * from './EventNotificationTypeFactory';
21
+ export * from './EventNotificationFactory';
22
+ export * from './EmailTemplateFactory';
23
+ export * from './RecordCategoryFactory';
24
+ export * from './RecordAnswerFactory';
18
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
@@ -18,4 +18,11 @@ tslib_1.__exportStar(require("./OrganizationTagFactory"), exports);
18
18
  tslib_1.__exportStar(require("./OrganizationRegistrationPeriodFactory"), exports);
19
19
  tslib_1.__exportStar(require("./MemberResponsibilityRecordFactory"), exports);
20
20
  tslib_1.__exportStar(require("./PlatformResponsibilityFactory"), exports);
21
+ tslib_1.__exportStar(require("./PlatformEventTypeFactory"), exports);
22
+ tslib_1.__exportStar(require("./EventFactory"), exports);
23
+ tslib_1.__exportStar(require("./EventNotificationTypeFactory"), exports);
24
+ tslib_1.__exportStar(require("./EventNotificationFactory"), exports);
25
+ tslib_1.__exportStar(require("./EmailTemplateFactory"), exports);
26
+ tslib_1.__exportStar(require("./RecordCategoryFactory"), exports);
27
+ tslib_1.__exportStar(require("./RecordAnswerFactory"), exports);
21
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factories/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,oEAA0C;AAC1C,yDAA+B;AAC/B,0DAAgC;AAChC,gEAAsC;AACtC,0DAAgC;AAChC,0DAAgC;AAChC,gEAAsC;AACtC,gEAAsC;AACtC,wDAA8B;AAC9B,2DAAiC;AACjC,+DAAqC;AACrC,sEAA4C;AAC5C,mEAAyC;AACzC,kFAAwD;AACxD,8EAAoD;AACpD,0EAAgD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factories/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,oEAA0C;AAC1C,yDAA+B;AAC/B,0DAAgC;AAChC,gEAAsC;AACtC,0DAAgC;AAChC,0DAAgC;AAChC,gEAAsC;AACtC,gEAAsC;AACtC,wDAA8B;AAC9B,2DAAiC;AACjC,+DAAqC;AACrC,sEAA4C;AAC5C,mEAAyC;AACzC,kFAAwD;AACxD,8EAAoD;AACpD,0EAAgD;AAChD,qEAA2C;AAC3C,yDAA+B;AAC/B,yEAA+C;AAC/C,qEAA2C;AAC3C,iEAAuC;AACvC,kEAAwC;AACxC,gEAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DNSValidator.d.ts","sourceRoot":"","sources":["../../../src/helpers/DNSValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkC,MAAM,uBAAuB,CAAC;AAIlF,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,QAAQ,UAAQ;;;GAwJjF"}
1
+ {"version":3,"file":"DNSValidator.d.ts","sourceRoot":"","sources":["../../../src/helpers/DNSValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkC,MAAM,uBAAuB,CAAC;AAIlF,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,QAAQ,UAAQ;;;GA8JjF"}