@shizuoka-its/core 2.1.0 → 2.1.2

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 (143) hide show
  1. package/README.md +13 -19
  2. package/dist/index.cjs +1914 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +754 -0
  5. package/dist/index.d.ts +754 -2
  6. package/dist/index.js +1873 -16
  7. package/dist/index.js.map +1 -0
  8. package/package.json +26 -14
  9. package/dist/application/exceptions/ApplicationExceptions.d.ts +0 -24
  10. package/dist/application/exceptions/ApplicationExceptions.js +0 -66
  11. package/dist/application/exceptions/index.d.ts +0 -1
  12. package/dist/application/exceptions/index.js +0 -17
  13. package/dist/application/index.d.ts +0 -4
  14. package/dist/application/index.js +0 -20
  15. package/dist/application/usecase/base.d.ts +0 -8
  16. package/dist/application/usecase/base.js +0 -11
  17. package/dist/application/usecase/event/AddExhibitToEvent.d.ts +0 -23
  18. package/dist/application/usecase/event/AddExhibitToEvent.js +0 -27
  19. package/dist/application/usecase/event/ChangeExhibitDescription.d.ts +0 -18
  20. package/dist/application/usecase/event/ChangeExhibitDescription.js +0 -24
  21. package/dist/application/usecase/event/ChangeExhibitMarkdownContent.d.ts +0 -18
  22. package/dist/application/usecase/event/ChangeExhibitMarkdownContent.js +0 -24
  23. package/dist/application/usecase/event/ChangeExhibitName.d.ts +0 -18
  24. package/dist/application/usecase/event/ChangeExhibitName.js +0 -24
  25. package/dist/application/usecase/event/ChangeExhibitUrl.d.ts +0 -18
  26. package/dist/application/usecase/event/ChangeExhibitUrl.js +0 -24
  27. package/dist/application/usecase/event/ChangeLightningTalkDuration.d.ts +0 -18
  28. package/dist/application/usecase/event/ChangeLightningTalkDuration.js +0 -24
  29. package/dist/application/usecase/event/ChangeLightningTalkSlideUrl.d.ts +0 -18
  30. package/dist/application/usecase/event/ChangeLightningTalkSlideUrl.js +0 -24
  31. package/dist/application/usecase/event/ChangeLightningTalkStartTime.d.ts +0 -18
  32. package/dist/application/usecase/event/ChangeLightningTalkStartTime.js +0 -24
  33. package/dist/application/usecase/event/CreateEvent.d.ts +0 -18
  34. package/dist/application/usecase/event/CreateEvent.js +0 -23
  35. package/dist/application/usecase/event/DeleteEvent.d.ts +0 -16
  36. package/dist/application/usecase/event/DeleteEvent.js +0 -23
  37. package/dist/application/usecase/event/GetEvent.d.ts +0 -16
  38. package/dist/application/usecase/event/GetEvent.js +0 -18
  39. package/dist/application/usecase/event/GetEventList.d.ts +0 -11
  40. package/dist/application/usecase/event/GetEventList.js +0 -15
  41. package/dist/application/usecase/event/RemoveExhibitFromEvent.d.ts +0 -17
  42. package/dist/application/usecase/event/RemoveExhibitFromEvent.js +0 -24
  43. package/dist/application/usecase/event/UpdateEvent.d.ts +0 -15
  44. package/dist/application/usecase/event/UpdateEvent.js +0 -26
  45. package/dist/application/usecase/event/index.d.ts +0 -14
  46. package/dist/application/usecase/event/index.js +0 -30
  47. package/dist/application/usecase/eventParticipation/GetEventsByMember.d.ts +0 -13
  48. package/dist/application/usecase/eventParticipation/GetEventsByMember.js +0 -15
  49. package/dist/application/usecase/eventParticipation/GetExhibitsByMember.d.ts +0 -13
  50. package/dist/application/usecase/eventParticipation/GetExhibitsByMember.js +0 -23
  51. package/dist/application/usecase/eventParticipation/GetMembersByEvent.d.ts +0 -14
  52. package/dist/application/usecase/eventParticipation/GetMembersByEvent.js +0 -23
  53. package/dist/application/usecase/eventParticipation/GetMembersByExhibit.d.ts +0 -14
  54. package/dist/application/usecase/eventParticipation/GetMembersByExhibit.js +0 -24
  55. package/dist/application/usecase/eventParticipation/RegisterMemberToEvent.d.ts +0 -15
  56. package/dist/application/usecase/eventParticipation/RegisterMemberToEvent.js +0 -26
  57. package/dist/application/usecase/eventParticipation/RegisterMemberToExhibit.d.ts +0 -15
  58. package/dist/application/usecase/eventParticipation/RegisterMemberToExhibit.js +0 -26
  59. package/dist/application/usecase/eventParticipation/RemoveMemberFromEvent.d.ts +0 -15
  60. package/dist/application/usecase/eventParticipation/RemoveMemberFromEvent.js +0 -22
  61. package/dist/application/usecase/eventParticipation/RemoveMemberFromExhibit.d.ts +0 -15
  62. package/dist/application/usecase/eventParticipation/RemoveMemberFromExhibit.js +0 -22
  63. package/dist/application/usecase/eventParticipation/index.d.ts +0 -8
  64. package/dist/application/usecase/eventParticipation/index.js +0 -25
  65. package/dist/application/usecase/index.d.ts +0 -4
  66. package/dist/application/usecase/index.js +0 -20
  67. package/dist/application/usecase/member/ChangeDiscordNickName.d.ts +0 -14
  68. package/dist/application/usecase/member/ChangeDiscordNickName.js +0 -25
  69. package/dist/application/usecase/member/ConnectDiscordAccount.d.ts +0 -15
  70. package/dist/application/usecase/member/ConnectDiscordAccount.js +0 -24
  71. package/dist/application/usecase/member/GetMember.d.ts +0 -13
  72. package/dist/application/usecase/member/GetMember.js +0 -15
  73. package/dist/application/usecase/member/GetMemberByDiscordId.d.ts +0 -13
  74. package/dist/application/usecase/member/GetMemberByDiscordId.js +0 -15
  75. package/dist/application/usecase/member/GetMemberByEmail.d.ts +0 -13
  76. package/dist/application/usecase/member/GetMemberByEmail.js +0 -15
  77. package/dist/application/usecase/member/GetMemberList.d.ts +0 -11
  78. package/dist/application/usecase/member/GetMemberList.js +0 -15
  79. package/dist/application/usecase/member/RegisterMember.d.ts +0 -21
  80. package/dist/application/usecase/member/RegisterMember.js +0 -31
  81. package/dist/application/usecase/member/UpdateMember.d.ts +0 -20
  82. package/dist/application/usecase/member/UpdateMember.js +0 -40
  83. package/dist/application/usecase/member/index.d.ts +0 -8
  84. package/dist/application/usecase/member/index.js +0 -24
  85. package/dist/domain/aggregates/event/Event.d.ts +0 -49
  86. package/dist/domain/aggregates/event/Event.js +0 -103
  87. package/dist/domain/aggregates/event/EventRepository.d.ts +0 -9
  88. package/dist/domain/aggregates/event/EventRepository.js +0 -2
  89. package/dist/domain/aggregates/event/Exhibit.d.ts +0 -42
  90. package/dist/domain/aggregates/event/Exhibit.js +0 -87
  91. package/dist/domain/aggregates/event/LightningTalk.d.ts +0 -20
  92. package/dist/domain/aggregates/event/LightningTalk.js +0 -39
  93. package/dist/domain/aggregates/event/index.d.ts +0 -4
  94. package/dist/domain/aggregates/event/index.js +0 -20
  95. package/dist/domain/aggregates/index.d.ts +0 -2
  96. package/dist/domain/aggregates/index.js +0 -18
  97. package/dist/domain/aggregates/member/DiscordAccount.d.ts +0 -15
  98. package/dist/domain/aggregates/member/DiscordAccount.js +0 -28
  99. package/dist/domain/aggregates/member/Member.d.ts +0 -43
  100. package/dist/domain/aggregates/member/Member.js +0 -83
  101. package/dist/domain/aggregates/member/MemberRepository.d.ts +0 -9
  102. package/dist/domain/aggregates/member/MemberRepository.js +0 -2
  103. package/dist/domain/aggregates/member/index.d.ts +0 -3
  104. package/dist/domain/aggregates/member/index.js +0 -19
  105. package/dist/domain/exceptions/DomainExceptions.d.ts +0 -42
  106. package/dist/domain/exceptions/DomainExceptions.js +0 -101
  107. package/dist/domain/exceptions/index.d.ts +0 -1
  108. package/dist/domain/exceptions/index.js +0 -17
  109. package/dist/domain/index.d.ts +0 -3
  110. package/dist/domain/index.js +0 -19
  111. package/dist/domain/value-objects/Departments.d.ts +0 -7
  112. package/dist/domain/value-objects/Departments.js +0 -22
  113. package/dist/domain/value-objects/Email.d.ts +0 -4
  114. package/dist/domain/value-objects/Email.js +0 -12
  115. package/dist/domain/value-objects/LightningTalkDuration.d.ts +0 -4
  116. package/dist/domain/value-objects/LightningTalkDuration.js +0 -11
  117. package/dist/domain/value-objects/UniversityEmail.d.ts +0 -4
  118. package/dist/domain/value-objects/UniversityEmail.js +0 -13
  119. package/dist/domain/value-objects/Url.d.ts +0 -4
  120. package/dist/domain/value-objects/Url.js +0 -19
  121. package/dist/domain/value-objects/ValueObject.d.ts +0 -8
  122. package/dist/domain/value-objects/ValueObject.js +0 -24
  123. package/dist/domain/value-objects/index.d.ts +0 -6
  124. package/dist/domain/value-objects/index.js +0 -22
  125. package/dist/executable/event.d.ts +0 -30
  126. package/dist/executable/event.js +0 -60
  127. package/dist/executable/index.d.ts +0 -2
  128. package/dist/executable/index.js +0 -18
  129. package/dist/executable/member.d.ts +0 -12
  130. package/dist/executable/member.js +0 -18
  131. package/dist/infrastructure/index.d.ts +0 -1
  132. package/dist/infrastructure/index.js +0 -17
  133. package/dist/infrastructure/prisma/PrismaEventRepository.d.ts +0 -23
  134. package/dist/infrastructure/prisma/PrismaEventRepository.js +0 -239
  135. package/dist/infrastructure/prisma/PrismaMemberRepository.d.ts +0 -11
  136. package/dist/infrastructure/prisma/PrismaMemberRepository.js +0 -99
  137. package/dist/infrastructure/prisma/index.d.ts +0 -2
  138. package/dist/infrastructure/prisma/index.js +0 -18
  139. package/prisma/migrations/20241107053440_init/migration.sql +0 -97
  140. package/prisma/migrations/20241107095139_/migration.sql +0 -14
  141. package/prisma/migrations/20241108213534_add_markdown_content_exhibit/migration.sql +0 -2
  142. package/prisma/migrations/migration_lock.toml +0 -3
  143. package/prisma/schema.prisma +0 -109
package/dist/index.cjs ADDED
@@ -0,0 +1,1914 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Department: () => Department,
24
+ DiscordAccount: () => DiscordAccount,
25
+ DiscordAccountAlreadyConnectedException: () => DiscordAccountAlreadyConnectedException,
26
+ DiscordAccountNotConnectedException: () => DiscordAccountNotConnectedException2,
27
+ DomainException: () => DomainException,
28
+ Email: () => Email,
29
+ Event: () => Event,
30
+ Exhibit: () => Exhibit,
31
+ ExhibitAlreadyExistsException: () => ExhibitAlreadyExistsException,
32
+ ExhibitHasMemberException: () => ExhibitHasMemberException,
33
+ ExhibitNotFoundException: () => ExhibitNotFoundException,
34
+ InvalidDepartmentException: () => InvalidDepartmentException,
35
+ InvalidEmailFormatException: () => InvalidEmailFormatException,
36
+ InvalidLightningTalkDurationException: () => InvalidLightningTalkDurationException,
37
+ InvalidUniversityEmailException: () => InvalidUniversityEmailException,
38
+ InvalidUrlException: () => InvalidUrlException,
39
+ InvalidUrlProtocolException: () => InvalidUrlProtocolException,
40
+ LightningTalk: () => LightningTalk,
41
+ LightningTalkDuration: () => LightningTalkDuration,
42
+ LightningTalkExhibitIdMismatchException: () => LightningTalkExhibitIdMismatchException,
43
+ LightningTalkNotFoundException: () => LightningTalkNotFoundException,
44
+ Member: () => Member,
45
+ UniversityEmail: () => UniversityEmail,
46
+ Url: () => Url,
47
+ ValueObject: () => ValueObject,
48
+ createEventUseCases: () => createEventUseCases,
49
+ createMemberUseCases: () => createMemberUseCases
50
+ });
51
+ module.exports = __toCommonJS(index_exports);
52
+
53
+ // src/application/exceptions/ApplicationExceptions.ts
54
+ var ApplicationException = class extends Error {
55
+ constructor(message) {
56
+ super(message);
57
+ this.name = "ApplicationException";
58
+ }
59
+ };
60
+ var EventNotFoundException = class extends ApplicationException {
61
+ constructor(eventId) {
62
+ const message = `\u30A4\u30D9\u30F3\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${eventId}`;
63
+ super(message);
64
+ this.name = "EventNotFoundException";
65
+ }
66
+ };
67
+ var ExhibitNotFoundFromExhibitIdException = class extends ApplicationException {
68
+ constructor(exhibitId) {
69
+ const message = `\u6307\u5B9A\u3055\u308C\u305F\u5C55\u793AID\u3067\u5C55\u793A\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${exhibitId}`;
70
+ super(message);
71
+ this.name = "ExhibitNotFoundFromExhibitIdException";
72
+ }
73
+ };
74
+ var MemberEmailAlreadyExistsException = class extends ApplicationException {
75
+ constructor(email) {
76
+ const message = `\u3053\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306F\u65E2\u306B\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u3059: ${email}`;
77
+ super(message);
78
+ this.name = "MemberEmailAlreadyExistsException";
79
+ }
80
+ };
81
+ var MemberNotFoundException = class extends ApplicationException {
82
+ constructor(memberId) {
83
+ const message = `\u30E1\u30F3\u30D0\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${memberId}`;
84
+ super(message);
85
+ this.name = "MemberNotFoundException";
86
+ }
87
+ };
88
+ var MemberNotFoundFromDiscordAccountIdException = class extends ApplicationException {
89
+ constructor(discordAccountId) {
90
+ const message = `\u6307\u5B9A\u3055\u308C\u305FDiscord\u30A2\u30AB\u30A6\u30F3\u30C8ID\u304B\u3089\u30E1\u30F3\u30D0\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: (Discord\u30A2\u30AB\u30A6\u30F3\u30C8ID) ${discordAccountId}`;
91
+ super(message);
92
+ this.name = "MemberNotFoundFromDiscordAccountIdException";
93
+ }
94
+ };
95
+ var DiscordAccountNotConnectedException = class extends ApplicationException {
96
+ constructor(userId, discordUserId) {
97
+ const message = `\u30E6\u30FC\u30B6\u30FC: ${userId} \u306EDiscord\u30A2\u30AB\u30A6\u30F3\u30C8\u306F\u7D10\u3065\u3044\u3066\u3044\u307E\u305B\u3093: ${discordUserId}`;
98
+ super(message);
99
+ this.name = "DiscordAccountNotConnectedException";
100
+ }
101
+ };
102
+
103
+ // src/application/usecase/base.ts
104
+ var IUseCase = class {
105
+ };
106
+
107
+ // src/application/usecase/member/ChangeDiscordNickName.ts
108
+ var ChangeDiscordNickNameUseCase = class extends IUseCase {
109
+ constructor(memberRepo) {
110
+ super();
111
+ this.memberRepo = memberRepo;
112
+ }
113
+ async execute(input) {
114
+ const member = await this.memberRepo.findByDiscordAccountId(
115
+ input.discordAccountId
116
+ );
117
+ if (!member) {
118
+ throw new MemberNotFoundFromDiscordAccountIdException(
119
+ input.discordAccountId
120
+ );
121
+ }
122
+ const discordAccount = member.getDiscordAccountById(input.discordAccountId);
123
+ if (!discordAccount) {
124
+ throw new DiscordAccountNotConnectedException(
125
+ member.id,
126
+ input.discordAccountId
127
+ );
128
+ }
129
+ discordAccount.setNickName(input.discordNickName);
130
+ await this.memberRepo.save(member);
131
+ return { member };
132
+ }
133
+ };
134
+
135
+ // src/domain/exceptions/DomainExceptions.ts
136
+ var DomainException = class extends Error {
137
+ constructor(message) {
138
+ super(message);
139
+ this.name = "DomainException";
140
+ }
141
+ };
142
+ var InvalidEmailFormatException = class extends DomainException {
143
+ constructor(email) {
144
+ super(`\u7121\u52B9\u306A\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306E\u5F62\u5F0F\u3067\u3059: ${email}`);
145
+ this.name = "InvalidEmailFormatException";
146
+ }
147
+ };
148
+ var DiscordAccountAlreadyConnectedException = class extends DomainException {
149
+ constructor() {
150
+ super("\u540C\u3058Discord\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u3059\u3067\u306B\u30E6\u30FC\u30B6\u30FC\u306B\u7D10\u3065\u3044\u3066\u3044\u307E\u3059");
151
+ this.name = "DiscordAccountAlreadyConnectedException";
152
+ }
153
+ };
154
+ var DiscordAccountNotConnectedException2 = class extends DomainException {
155
+ constructor() {
156
+ super("\u6307\u5B9A\u3055\u308C\u305FDiscord\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u30E6\u30FC\u30B6\u30FC\u306B\u7D10\u3065\u3044\u3066\u3044\u307E\u305B\u3093");
157
+ this.name = "DiscordAccountNotConnectedException";
158
+ }
159
+ };
160
+ var InvalidUniversityEmailException = class extends DomainException {
161
+ constructor(email) {
162
+ super(`\u7121\u52B9\u306A\u5927\u5B66\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u3059: ${email} (\u5927\u5B66\u30C9\u30E1\u30A4\u30F3\u304C\u5FC5\u8981\u3067\u3059)`);
163
+ this.name = "InvalidUniversityEmailException";
164
+ }
165
+ };
166
+ var InvalidDepartmentException = class extends DomainException {
167
+ constructor(department) {
168
+ super(
169
+ `\u7121\u52B9\u306A\u5B66\u90E8\u8B58\u5225\u5B50\u3067\u3059: ${department} (\u6709\u52B9\u5024: CS, BI, IA, GRADUATE, ALUMNI, OTHERS)`
170
+ );
171
+ this.name = "InvalidDepartmentException";
172
+ }
173
+ };
174
+ var InvalidLightningTalkDurationException = class extends DomainException {
175
+ constructor(duration) {
176
+ super(
177
+ `\u7121\u52B9\u306A\u30E9\u30A4\u30C8\u30CB\u30F3\u30B0\u30C8\u30FC\u30AF\u306E\u9577\u3055\u3067\u3059: ${duration}\u5206 (\u6B63\u306E\u6570\u5024\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044)`
178
+ );
179
+ this.name = "InvalidLightningTalkDurationException";
180
+ }
181
+ };
182
+ var InvalidUrlException = class extends DomainException {
183
+ constructor(url) {
184
+ super(`\u7121\u52B9\u306AURL\u3067\u3059: ${url}`);
185
+ this.name = "InvalidUrlException";
186
+ }
187
+ };
188
+ var InvalidUrlProtocolException = class extends DomainException {
189
+ constructor(url, protocol) {
190
+ super(
191
+ `\u6307\u5B9A\u3055\u308C\u305FURL\u306E\u30D7\u30ED\u30C8\u30B3\u30EB\u306F\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093: ${url} (\u30D7\u30ED\u30C8\u30B3\u30EB: ${protocol})`
192
+ );
193
+ this.name = "InvalidUrlProtocolException";
194
+ }
195
+ };
196
+ var ExhibitAlreadyExistsException = class extends DomainException {
197
+ constructor(exhibitId) {
198
+ super(`\u65E2\u306B\u540C\u4E00\u306E\u5C55\u793A\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u3059: ${exhibitId}`);
199
+ this.name = "ExhibitAlreadyExistsException";
200
+ }
201
+ };
202
+ var ExhibitNotFoundException = class extends DomainException {
203
+ constructor(exhibitId) {
204
+ super(`\u6307\u5B9A\u3055\u308C\u305F\u5C55\u793A\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${exhibitId}`);
205
+ this.name = "ExhibitNotFoundException";
206
+ }
207
+ };
208
+ var LightningTalkNotFoundException = class extends DomainException {
209
+ constructor(lightningTalkId) {
210
+ super(`\u6307\u5B9A\u3055\u308C\u305F\u30E9\u30A4\u30C8\u30CB\u30F3\u30B0\u30C8\u30FC\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${lightningTalkId}`);
211
+ this.name = "LightningTalkNotFoundException";
212
+ }
213
+ };
214
+ var LightningTalkExhibitIdMismatchException = class extends DomainException {
215
+ constructor(lightningTalkId, exhibitId) {
216
+ super(
217
+ `\u6307\u5B9A\u3055\u308C\u305F\u30E9\u30A4\u30C8\u30CB\u30F3\u30B0\u30C8\u30FC\u30AF\u306Eid\u304C\u5C55\u793A\u306Eid\u3068\u4E00\u81F4\u3057\u3066\u3044\u307E\u305B\u3093: \u30E9\u30A4\u30C8\u30CB\u30F3\u30B0\u30C8\u30FC\u30AFID ${lightningTalkId}, \u5C55\u793AID ${exhibitId}`
218
+ );
219
+ this.name = "LightningTalkExhibitIdMismatchException";
220
+ }
221
+ };
222
+ var ExhibitHasMemberException = class extends DomainException {
223
+ constructor(exhibitId, memberId) {
224
+ super(
225
+ `\u30A4\u30D9\u30F3\u30C8\u306B\u7D10\u3065\u3044\u305F\u5C55\u793A\u306B\u5F53\u8A72\u30E1\u30F3\u30D0\u30FC\u304C\u3044\u308B\u305F\u3081\u3001Event\u304B\u3089\u524A\u9664\u3067\u304D\u307E\u305B\u3093: \u5C55\u793AID ${exhibitId}, \u30E1\u30F3\u30D0\u30FCID ${memberId}`
226
+ );
227
+ this.name = "ExhibitHasMemberException";
228
+ }
229
+ };
230
+
231
+ // src/domain/value-objects/ValueObject.ts
232
+ var ValueObject = class {
233
+ constructor(value) {
234
+ this.value = value;
235
+ this.validate();
236
+ }
237
+ getValue() {
238
+ return this.value;
239
+ }
240
+ equals(vo) {
241
+ if (vo === null || vo === void 0) {
242
+ return false;
243
+ }
244
+ return JSON.stringify(this.value) === JSON.stringify(vo.value);
245
+ }
246
+ throwIfInvalid(isValid, exception) {
247
+ if (!isValid) {
248
+ throw exception;
249
+ }
250
+ }
251
+ };
252
+
253
+ // src/domain/value-objects/Departments.ts
254
+ var Department = class _Department extends ValueObject {
255
+ static fromString(value) {
256
+ return new _Department(value);
257
+ }
258
+ validate() {
259
+ const validDepartments = [
260
+ "CS",
261
+ "BI",
262
+ "IA",
263
+ "GRADUATE",
264
+ "ALUMNI",
265
+ "OTHERS"
266
+ ];
267
+ this.throwIfInvalid(
268
+ validDepartments.includes(this.value),
269
+ new InvalidDepartmentException(this.value)
270
+ );
271
+ }
272
+ };
273
+
274
+ // src/domain/value-objects/Email.ts
275
+ var Email = class extends ValueObject {
276
+ validate() {
277
+ const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
278
+ this.throwIfInvalid(
279
+ emailRegex.test(this.value),
280
+ new InvalidEmailFormatException(this.value)
281
+ );
282
+ }
283
+ };
284
+
285
+ // src/domain/value-objects/LightningTalkDuration.ts
286
+ var LightningTalkDuration = class extends ValueObject {
287
+ validate() {
288
+ this.throwIfInvalid(
289
+ this.value > 0,
290
+ new InvalidLightningTalkDurationException(this.value)
291
+ );
292
+ }
293
+ };
294
+
295
+ // src/domain/value-objects/UniversityEmail.ts
296
+ var UNIVERSITY_EMAIL_DOMAIN = "@shizuoka.ac.jp";
297
+ var UniversityEmail = class extends Email {
298
+ validate() {
299
+ super.validate();
300
+ this.throwIfInvalid(
301
+ this.value.endsWith(UNIVERSITY_EMAIL_DOMAIN),
302
+ new InvalidUniversityEmailException(this.value)
303
+ );
304
+ }
305
+ };
306
+
307
+ // src/domain/value-objects/Url.ts
308
+ var Url = class extends ValueObject {
309
+ validate() {
310
+ let parsed;
311
+ try {
312
+ parsed = new URL(this.value);
313
+ } catch {
314
+ this.throwIfInvalid(false, new InvalidUrlException(this.value));
315
+ return;
316
+ }
317
+ this.throwIfInvalid(
318
+ ["http:", "https:"].includes(parsed.protocol),
319
+ new InvalidUrlProtocolException(this.value, parsed.protocol)
320
+ );
321
+ }
322
+ };
323
+
324
+ // src/domain/aggregates/event/Event.ts
325
+ var Event = class {
326
+ constructor(id, name, date) {
327
+ this.id = id;
328
+ this.name = name;
329
+ this.date = date;
330
+ }
331
+ exhibits = [];
332
+ memberIds = /* @__PURE__ */ new Set();
333
+ getName() {
334
+ return this.name;
335
+ }
336
+ getDate() {
337
+ return this.date;
338
+ }
339
+ getExhibits() {
340
+ return this.exhibits;
341
+ }
342
+ getMemberIds() {
343
+ return Array.from(this.memberIds);
344
+ }
345
+ changeName(newName) {
346
+ this.name = newName;
347
+ }
348
+ changeDate(newDate) {
349
+ this.date = newDate;
350
+ }
351
+ addExhibit(exhibit) {
352
+ if (this.exhibits.some((x) => x.id === exhibit.id)) {
353
+ throw new ExhibitAlreadyExistsException(
354
+ `Exhibit(id=${exhibit.id}) \u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059`
355
+ );
356
+ }
357
+ for (const memberId of exhibit.getMemberIds()) {
358
+ this.memberIds.add(memberId);
359
+ }
360
+ this.exhibits.push(exhibit);
361
+ }
362
+ removeExhibit(exhibitId) {
363
+ this.getExhibitOrThrow(exhibitId);
364
+ this.exhibits = this.exhibits.filter((x) => x.id !== exhibitId);
365
+ }
366
+ changeExhibitName(exhibitId, newName) {
367
+ this.getExhibitOrThrow(exhibitId).changeName(newName);
368
+ }
369
+ changeExhibitDescription(exhibitId, newDescription) {
370
+ this.getExhibitOrThrow(exhibitId).changeDescription(newDescription);
371
+ }
372
+ changeExhibitMarkdownContent(exhibitId, newMarkdownContent) {
373
+ this.getExhibitOrThrow(exhibitId).changeMarkdownContent(newMarkdownContent);
374
+ }
375
+ changeExhibitUrl(exhibitId, newUrl) {
376
+ this.getExhibitOrThrow(exhibitId).changeUrl(newUrl);
377
+ }
378
+ changeExhibitLightningTalkStartTime(exhibitId, newStartTime) {
379
+ this.getExhibitOrThrow(exhibitId).changeLightningTalkStartTime(
380
+ newStartTime
381
+ );
382
+ }
383
+ changeExhibitLightningTalkDuration(exhibitId, newDuration) {
384
+ this.getExhibitOrThrow(exhibitId).changeLightningTalkDuration(newDuration);
385
+ }
386
+ changeExhibitLightningTalkSlideUrl(exhibitId, newSlideUrl) {
387
+ this.getExhibitOrThrow(exhibitId).changeLightningTalkSlideUrl(newSlideUrl);
388
+ }
389
+ getExhibitOrThrow(exhibitId) {
390
+ const exhibit = this.exhibits.find((x) => x.id === exhibitId);
391
+ if (!exhibit) {
392
+ throw new ExhibitNotFoundException(
393
+ `Exhibit(id=${exhibitId}) \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093`
394
+ );
395
+ }
396
+ return exhibit;
397
+ }
398
+ addMemberId(memberId) {
399
+ this.memberIds.add(memberId);
400
+ }
401
+ removeMemberId(memberId) {
402
+ for (const exhibit of this.exhibits) {
403
+ if (exhibit.getMemberIds().includes(memberId)) {
404
+ throw new ExhibitHasMemberException(exhibit.id, memberId);
405
+ }
406
+ }
407
+ this.memberIds.delete(memberId);
408
+ }
409
+ addExhibitMemberId(exhibitId, memberId) {
410
+ this.getExhibitOrThrow(exhibitId).addMemberId(memberId);
411
+ this.memberIds.add(memberId);
412
+ }
413
+ removeExhibitMemberId(exhibitId, memberId) {
414
+ }
415
+ toSnapshot() {
416
+ return {
417
+ id: this.id,
418
+ name: this.name,
419
+ date: this.date,
420
+ exhibits: this.exhibits.map((exhibit) => exhibit.toSnapshot()),
421
+ memberIds: Array.from(this.memberIds)
422
+ };
423
+ }
424
+ };
425
+
426
+ // src/domain/aggregates/event/Exhibit.ts
427
+ var Exhibit = class _Exhibit {
428
+ constructor(id, name, description, markdownContent, url) {
429
+ this.id = id;
430
+ this.name = name;
431
+ this.description = description;
432
+ this.markdownContent = markdownContent;
433
+ this.url = url;
434
+ }
435
+ lightningTalk;
436
+ memberIds = /* @__PURE__ */ new Set();
437
+ // NOTE: LightningTalkのExhibitコンストラクタ(TypeScriptは2つのコンストラクタを持てないため)
438
+ static createWithLightningTalk(id, name, lt, description, markdownContent, url) {
439
+ const exhibit = new _Exhibit(id, name, description, markdownContent, url);
440
+ if (lt.exhibitId !== id) {
441
+ throw new LightningTalkExhibitIdMismatchException(id, lt.exhibitId);
442
+ }
443
+ exhibit.lightningTalk = lt;
444
+ return exhibit;
445
+ }
446
+ getName() {
447
+ return this.name;
448
+ }
449
+ getDescription() {
450
+ return this.description;
451
+ }
452
+ getMarkdownContent() {
453
+ return this.markdownContent;
454
+ }
455
+ getUrl() {
456
+ return this.url;
457
+ }
458
+ getLightningTalk() {
459
+ return this.lightningTalk;
460
+ }
461
+ getMemberIds() {
462
+ return Array.from(this.memberIds);
463
+ }
464
+ changeName(newName) {
465
+ this.name = newName;
466
+ }
467
+ changeDescription(newDescription) {
468
+ this.description = newDescription;
469
+ }
470
+ changeMarkdownContent(newMarkdownContent) {
471
+ this.markdownContent = newMarkdownContent;
472
+ }
473
+ changeUrl(newUrl) {
474
+ this.url = newUrl;
475
+ }
476
+ changeLightningTalkStartTime(newStartTime) {
477
+ this.getLightningTalkOrThrow().changeStartTime(newStartTime);
478
+ }
479
+ changeLightningTalkDuration(newDuration) {
480
+ this.getLightningTalkOrThrow().changeDuration(newDuration);
481
+ }
482
+ changeLightningTalkSlideUrl(newSlideUrl) {
483
+ this.getLightningTalkOrThrow().changeSlideUrl(newSlideUrl);
484
+ }
485
+ addMemberId(memberId) {
486
+ this.memberIds.add(memberId);
487
+ }
488
+ removeMemberId(memberId) {
489
+ this.memberIds.delete(memberId);
490
+ }
491
+ getLightningTalkOrThrow() {
492
+ if (!this.lightningTalk) {
493
+ throw new LightningTalkNotFoundException(
494
+ `Exhibit(id=${this.id}) \u306B\u7D10\u3065\u304F LightningTalk \u304C\u5B58\u5728\u3057\u307E\u305B\u3093`
495
+ );
496
+ }
497
+ return this.lightningTalk;
498
+ }
499
+ toSnapshot() {
500
+ return {
501
+ id: this.id,
502
+ name: this.name,
503
+ description: this.description,
504
+ markdownContent: this.markdownContent,
505
+ url: this.url,
506
+ lightningTalk: this.lightningTalk?.toSnapshot()
507
+ };
508
+ }
509
+ };
510
+
511
+ // src/domain/aggregates/event/LightningTalk.ts
512
+ var LightningTalk = class {
513
+ constructor(exhibitId, startTime, durationMinutes, slideUrl) {
514
+ this.exhibitId = exhibitId;
515
+ this.startTime = startTime;
516
+ this.durationMinutes = durationMinutes;
517
+ this.slideUrl = slideUrl;
518
+ }
519
+ getStartTime() {
520
+ return this.startTime;
521
+ }
522
+ getDurationMinutes() {
523
+ return this.durationMinutes;
524
+ }
525
+ getSlideUrl() {
526
+ return this.slideUrl;
527
+ }
528
+ changeSlideUrl(newSlideUrl) {
529
+ this.slideUrl = newSlideUrl;
530
+ }
531
+ changeDuration(newDuration) {
532
+ this.durationMinutes = newDuration;
533
+ }
534
+ // TODO: イベントの期間内かどうかをチェックする必要がある?
535
+ changeStartTime(newStartTime) {
536
+ this.startTime = newStartTime;
537
+ }
538
+ toSnapshot() {
539
+ return {
540
+ exhibitId: this.exhibitId,
541
+ startTime: this.startTime,
542
+ durationMinutes: this.durationMinutes,
543
+ slideUrl: this.slideUrl
544
+ };
545
+ }
546
+ };
547
+
548
+ // src/domain/aggregates/member/Member.ts
549
+ var Member = class {
550
+ constructor(id, name, studentId, department, email, personalEmail) {
551
+ this.id = id;
552
+ this.name = name;
553
+ this.studentId = studentId;
554
+ this.department = department;
555
+ this.email = email;
556
+ this.personalEmail = personalEmail;
557
+ }
558
+ discordAccounts = [];
559
+ getName() {
560
+ return this.name;
561
+ }
562
+ getStudentId() {
563
+ return this.studentId;
564
+ }
565
+ getDepartment() {
566
+ return this.department;
567
+ }
568
+ getEmail() {
569
+ return this.email;
570
+ }
571
+ getPersonalEmail() {
572
+ return this.personalEmail;
573
+ }
574
+ getDiscordAccounts() {
575
+ return this.discordAccounts;
576
+ }
577
+ setName(newName) {
578
+ this.name = newName;
579
+ }
580
+ setStudentId(newStudentId) {
581
+ this.studentId = newStudentId;
582
+ }
583
+ setDepartment(newDepartment) {
584
+ this.department = newDepartment;
585
+ }
586
+ setEmail(newEmail) {
587
+ this.email = newEmail;
588
+ }
589
+ setPersonalEmail(newPersonalEmail) {
590
+ this.personalEmail = newPersonalEmail;
591
+ }
592
+ addDiscordAccount(discordAccount) {
593
+ if (this.getDiscordAccountById(discordAccount.id)) {
594
+ throw new DiscordAccountAlreadyConnectedException();
595
+ }
596
+ this.discordAccounts.push(discordAccount);
597
+ }
598
+ removeDiscordAccount(discordAccountId) {
599
+ this.getDiscordAccountOrThrow(discordAccountId);
600
+ this.discordAccounts = this.discordAccounts.filter(
601
+ (account) => account.id !== discordAccountId
602
+ );
603
+ }
604
+ getDiscordAccountById(discordAccountId) {
605
+ return this.discordAccounts.find(
606
+ (account) => account.id === discordAccountId
607
+ );
608
+ }
609
+ getDiscordAccountOrThrow(discordAccountId) {
610
+ const account = this.getDiscordAccountById(discordAccountId);
611
+ if (!account) {
612
+ throw new DiscordAccountNotConnectedException2();
613
+ }
614
+ return account;
615
+ }
616
+ setDiscordAccountNickName(discordAccountId, newNickName) {
617
+ this.getDiscordAccountOrThrow(discordAccountId).setNickName(newNickName);
618
+ }
619
+ toSnapshot() {
620
+ return {
621
+ id: this.id,
622
+ name: this.name,
623
+ studentId: this.studentId,
624
+ department: this.department,
625
+ email: this.email,
626
+ personalEmail: this.personalEmail,
627
+ discordAccounts: this.discordAccounts.map(
628
+ (account) => account.toSnapshot()
629
+ )
630
+ };
631
+ }
632
+ };
633
+
634
+ // src/domain/aggregates/member/DiscordAccount.ts
635
+ var DiscordAccount = class {
636
+ constructor(id, nickName, memberId) {
637
+ this.id = id;
638
+ this.nickName = nickName;
639
+ this.memberId = memberId;
640
+ }
641
+ getNickName() {
642
+ return this.nickName;
643
+ }
644
+ getMemberId() {
645
+ return this.memberId;
646
+ }
647
+ setNickName(newNickName) {
648
+ this.nickName = newNickName;
649
+ }
650
+ toSnapshot() {
651
+ return {
652
+ id: this.id,
653
+ nickName: this.nickName,
654
+ memberId: this.memberId
655
+ };
656
+ }
657
+ };
658
+
659
+ // src/application/usecase/member/ConnectDiscordAccount.ts
660
+ var ConnectDiscordAccountUseCase = class extends IUseCase {
661
+ constructor(memberRepo) {
662
+ super();
663
+ this.memberRepo = memberRepo;
664
+ }
665
+ async execute(input) {
666
+ const member = await this.memberRepo.findById(input.memberId);
667
+ if (!member) {
668
+ throw new MemberNotFoundException(input.memberId);
669
+ }
670
+ const discordAccount = new DiscordAccount(
671
+ input.discordAccountId,
672
+ input.discordNickName ?? "",
673
+ member.id
674
+ );
675
+ member.addDiscordAccount(discordAccount);
676
+ await this.memberRepo.save(member);
677
+ return { member };
678
+ }
679
+ };
680
+
681
+ // src/application/usecase/member/GetMember.ts
682
+ var GetMemberUseCase = class extends IUseCase {
683
+ constructor(memberRepo) {
684
+ super();
685
+ this.memberRepo = memberRepo;
686
+ }
687
+ async execute(input) {
688
+ const member = await this.memberRepo.findById(input.id);
689
+ return { member };
690
+ }
691
+ };
692
+
693
+ // src/application/usecase/member/GetMemberByEmail.ts
694
+ var GetMemberByEmailUseCase = class extends IUseCase {
695
+ constructor(memberRepo) {
696
+ super();
697
+ this.memberRepo = memberRepo;
698
+ }
699
+ async execute(input) {
700
+ const member = await this.memberRepo.findByEmail(input.email);
701
+ return { member };
702
+ }
703
+ };
704
+
705
+ // src/application/usecase/member/GetMemberByDiscordId.ts
706
+ var GetMemberByDiscordIdUseCase = class extends IUseCase {
707
+ constructor(memberRepo) {
708
+ super();
709
+ this.memberRepo = memberRepo;
710
+ }
711
+ async execute(input) {
712
+ const member = await this.memberRepo.findByDiscordAccountId(
713
+ input.discordId
714
+ );
715
+ return { member };
716
+ }
717
+ };
718
+
719
+ // src/application/usecase/member/GetMemberList.ts
720
+ var GetMemberListUseCase = class extends IUseCase {
721
+ constructor(memberRepo) {
722
+ super();
723
+ this.memberRepo = memberRepo;
724
+ }
725
+ async execute(_input) {
726
+ const members2 = await this.memberRepo.findAll();
727
+ return { members: members2 };
728
+ }
729
+ };
730
+
731
+ // src/application/usecase/member/RegisterMember.ts
732
+ var import_uuid = require("uuid");
733
+ var RegisterMemberUseCase = class extends IUseCase {
734
+ constructor(memberRepo) {
735
+ super();
736
+ this.memberRepo = memberRepo;
737
+ }
738
+ async execute(input) {
739
+ const existingMember = await this.memberRepo.findByEmail(input.email);
740
+ if (existingMember) {
741
+ throw new MemberEmailAlreadyExistsException(input.email);
742
+ }
743
+ const universityEmail = new UniversityEmail(input.email);
744
+ const personalEmail = input.personalEmail ? new Email(input.personalEmail) : void 0;
745
+ const member = new Member(
746
+ (0, import_uuid.v4)(),
747
+ input.name,
748
+ input.studentId,
749
+ Department.fromString(input.department),
750
+ universityEmail,
751
+ personalEmail
752
+ );
753
+ if (input.discordInfo) {
754
+ const discordAccount = new DiscordAccount(
755
+ input.discordInfo.accountId,
756
+ input.discordInfo.nickName,
757
+ member.id
758
+ );
759
+ member.addDiscordAccount(discordAccount);
760
+ }
761
+ await this.memberRepo.save(member);
762
+ return { member };
763
+ }
764
+ };
765
+
766
+ // src/application/usecase/member/UpdateMember.ts
767
+ var UpdateMemberUseCase = class extends IUseCase {
768
+ constructor(memberRepo) {
769
+ super();
770
+ this.memberRepo = memberRepo;
771
+ }
772
+ async execute(input) {
773
+ const member = await this.memberRepo.findById(input.memberId);
774
+ if (!member) {
775
+ throw new MemberNotFoundException(input.memberId);
776
+ }
777
+ if (input.name) {
778
+ member.setName(input.name);
779
+ }
780
+ if (input.studentId) {
781
+ member.setStudentId(input.studentId);
782
+ }
783
+ if (input.department) {
784
+ member.setDepartment(Department.fromString(input.department));
785
+ }
786
+ if (input.email) {
787
+ member.setEmail(new UniversityEmail(input.email));
788
+ }
789
+ if (input.personalEmail) {
790
+ member.setPersonalEmail(new Email(input.personalEmail));
791
+ }
792
+ if (input.discordAccountId && input.discordNickName) {
793
+ const discordAccount = new DiscordAccount(
794
+ input.discordAccountId,
795
+ input.discordNickName,
796
+ member.id
797
+ );
798
+ member.addDiscordAccount(discordAccount);
799
+ }
800
+ await this.memberRepo.save(member);
801
+ return { member };
802
+ }
803
+ };
804
+
805
+ // src/application/usecase/event/AddExhibitToEvent.ts
806
+ var AddExhibitToEvent = class extends IUseCase {
807
+ constructor(eventRepository) {
808
+ super();
809
+ this.eventRepository = eventRepository;
810
+ }
811
+ async execute(input) {
812
+ const event = await this.eventRepository.findById(input.eventId);
813
+ if (!event) {
814
+ throw new EventNotFoundException(input.eventId);
815
+ }
816
+ const { id, name, description, markdownContent, url } = input.exhibit;
817
+ const exhibit = new Exhibit(id, name, description, markdownContent, url);
818
+ event.addExhibit(exhibit);
819
+ await this.eventRepository.save(event);
820
+ return { event };
821
+ }
822
+ };
823
+
824
+ // src/application/usecase/event/ChangeExhibitDescription.ts
825
+ var ChangeExhibitDescription = class extends IUseCase {
826
+ constructor(eventRepository) {
827
+ super();
828
+ this.eventRepository = eventRepository;
829
+ }
830
+ async execute(input) {
831
+ const event = await this.eventRepository.findById(input.eventId);
832
+ if (!event) {
833
+ throw new EventNotFoundException(input.eventId);
834
+ }
835
+ event.changeExhibitDescription(input.exhibitId, input.newDescription);
836
+ await this.eventRepository.save(event);
837
+ return { event };
838
+ }
839
+ };
840
+
841
+ // src/application/usecase/event/ChangeExhibitMarkdownContent.ts
842
+ var ChangeExhibitMarkdownContent = class extends IUseCase {
843
+ constructor(eventRepository) {
844
+ super();
845
+ this.eventRepository = eventRepository;
846
+ }
847
+ async execute(input) {
848
+ const event = await this.eventRepository.findById(input.eventId);
849
+ if (!event) {
850
+ throw new EventNotFoundException(input.eventId);
851
+ }
852
+ event.changeExhibitMarkdownContent(
853
+ input.exhibitId,
854
+ input.newMarkdownContent
855
+ );
856
+ await this.eventRepository.save(event);
857
+ return { event };
858
+ }
859
+ };
860
+
861
+ // src/application/usecase/event/ChangeExhibitName.ts
862
+ var ChangeExhibitName = class extends IUseCase {
863
+ constructor(eventRepository) {
864
+ super();
865
+ this.eventRepository = eventRepository;
866
+ }
867
+ async execute(input) {
868
+ const event = await this.eventRepository.findById(input.eventId);
869
+ if (!event) {
870
+ throw new EventNotFoundException(input.eventId);
871
+ }
872
+ event.changeExhibitName(input.exhibitId, input.newName);
873
+ await this.eventRepository.save(event);
874
+ return { event };
875
+ }
876
+ };
877
+
878
+ // src/application/usecase/event/ChangeExhibitUrl.ts
879
+ var ChangeExhibitUrl = class extends IUseCase {
880
+ constructor(eventRepository) {
881
+ super();
882
+ this.eventRepository = eventRepository;
883
+ }
884
+ async execute(input) {
885
+ const event = await this.eventRepository.findById(input.eventId);
886
+ if (!event) {
887
+ throw new EventNotFoundException(input.eventId);
888
+ }
889
+ event.changeExhibitUrl(input.exhibitId, input.newUrl);
890
+ await this.eventRepository.save(event);
891
+ return { event };
892
+ }
893
+ };
894
+
895
+ // src/application/usecase/event/ChangeLightningTalkDuration.ts
896
+ var ChangeLightningTalkDuration = class extends IUseCase {
897
+ constructor(eventRepository) {
898
+ super();
899
+ this.eventRepository = eventRepository;
900
+ }
901
+ async execute(input) {
902
+ const event = await this.eventRepository.findById(input.eventId);
903
+ if (!event) {
904
+ throw new EventNotFoundException(input.eventId);
905
+ }
906
+ event.changeExhibitLightningTalkDuration(
907
+ input.exhibitId,
908
+ input.newDuration
909
+ );
910
+ await this.eventRepository.save(event);
911
+ return { event };
912
+ }
913
+ };
914
+
915
+ // src/application/usecase/event/ChangeLightningTalkSlideUrl.ts
916
+ var ChangeLightningTalkSlideUrl = class extends IUseCase {
917
+ constructor(eventRepository) {
918
+ super();
919
+ this.eventRepository = eventRepository;
920
+ }
921
+ async execute(input) {
922
+ const event = await this.eventRepository.findById(input.eventId);
923
+ if (!event) {
924
+ throw new EventNotFoundException(input.eventId);
925
+ }
926
+ event.changeExhibitLightningTalkSlideUrl(
927
+ input.exhibitId,
928
+ input.newSlideUrl
929
+ );
930
+ await this.eventRepository.save(event);
931
+ return { event };
932
+ }
933
+ };
934
+
935
+ // src/application/usecase/event/ChangeLightningTalkStartTime.ts
936
+ var ChangeLightningTalkStartTime = class extends IUseCase {
937
+ constructor(eventRepository) {
938
+ super();
939
+ this.eventRepository = eventRepository;
940
+ }
941
+ async execute(input) {
942
+ const event = await this.eventRepository.findById(input.eventId);
943
+ if (!event) {
944
+ throw new EventNotFoundException(input.eventId);
945
+ }
946
+ event.changeExhibitLightningTalkStartTime(
947
+ input.exhibitId,
948
+ input.newStartTime
949
+ );
950
+ await this.eventRepository.save(event);
951
+ return { event };
952
+ }
953
+ };
954
+
955
+ // src/application/usecase/event/CreateEvent.ts
956
+ var CreateEvent = class extends IUseCase {
957
+ constructor(eventRepository) {
958
+ super();
959
+ this.eventRepository = eventRepository;
960
+ }
961
+ async execute(input) {
962
+ const { id, name, date } = input;
963
+ const event = new Event(id, name, date);
964
+ await this.eventRepository.save(event);
965
+ return { event };
966
+ }
967
+ };
968
+
969
+ // src/application/usecase/event/DeleteEvent.ts
970
+ var DeleteEvent = class extends IUseCase {
971
+ constructor(eventRepository) {
972
+ super();
973
+ this.eventRepository = eventRepository;
974
+ }
975
+ async execute(input) {
976
+ const event = await this.eventRepository.findById(input.eventId);
977
+ if (!event) {
978
+ throw new EventNotFoundException(input.eventId);
979
+ }
980
+ await this.eventRepository.delete(input.eventId);
981
+ return { event };
982
+ }
983
+ };
984
+
985
+ // src/application/usecase/event/GetEvent.ts
986
+ var GetEvent = class extends IUseCase {
987
+ constructor(eventRepository) {
988
+ super();
989
+ this.eventRepository = eventRepository;
990
+ }
991
+ async execute(input) {
992
+ const event = await this.eventRepository.findById(input.eventId);
993
+ return { event };
994
+ }
995
+ };
996
+
997
+ // src/application/usecase/event/GetEventList.ts
998
+ var GetEventList = class extends IUseCase {
999
+ constructor(eventRepository) {
1000
+ super();
1001
+ this.eventRepository = eventRepository;
1002
+ }
1003
+ async execute(_input) {
1004
+ const events2 = await this.eventRepository.findAll();
1005
+ return { events: events2 };
1006
+ }
1007
+ };
1008
+
1009
+ // src/application/usecase/event/RemoveExhibitFromEvent.ts
1010
+ var RemoveExhibitFromEvent = class extends IUseCase {
1011
+ constructor(eventRepository) {
1012
+ super();
1013
+ this.eventRepository = eventRepository;
1014
+ }
1015
+ async execute(input) {
1016
+ const event = await this.eventRepository.findById(input.eventId);
1017
+ if (!event) {
1018
+ throw new EventNotFoundException(input.eventId);
1019
+ }
1020
+ event.removeExhibit(input.exhibitId);
1021
+ await this.eventRepository.save(event);
1022
+ return { event };
1023
+ }
1024
+ };
1025
+
1026
+ // src/application/usecase/event/UpdateEvent.ts
1027
+ var UpdateEvent = class extends IUseCase {
1028
+ constructor(eventRepository) {
1029
+ super();
1030
+ this.eventRepository = eventRepository;
1031
+ }
1032
+ async execute(input) {
1033
+ const event = await this.eventRepository.findById(input.eventId);
1034
+ if (!event) {
1035
+ throw new EventNotFoundException(input.eventId);
1036
+ }
1037
+ if (input.name !== void 0) {
1038
+ event.changeName(input.name);
1039
+ }
1040
+ if (input.date !== void 0) {
1041
+ event.changeDate(input.date);
1042
+ }
1043
+ await this.eventRepository.save(event);
1044
+ return { event };
1045
+ }
1046
+ };
1047
+
1048
+ // src/application/usecase/eventParticipation/RegisterMemberToEvent.ts
1049
+ var RegisterMemberToEvent = class extends IUseCase {
1050
+ constructor(eventRepository, memberRepository) {
1051
+ super();
1052
+ this.eventRepository = eventRepository;
1053
+ this.memberRepository = memberRepository;
1054
+ }
1055
+ async execute(input) {
1056
+ const event = await this.eventRepository.findById(input.eventId);
1057
+ if (!event) {
1058
+ throw new EventNotFoundException(input.eventId);
1059
+ }
1060
+ const member = await this.memberRepository.findById(input.memberId);
1061
+ if (!member) {
1062
+ throw new MemberNotFoundException(input.memberId);
1063
+ }
1064
+ event.addMemberId(input.memberId);
1065
+ await this.eventRepository.save(event);
1066
+ return { event };
1067
+ }
1068
+ };
1069
+
1070
+ // src/application/usecase/eventParticipation/RemoveMemberFromEvent.ts
1071
+ var RemoveMemberFromEvent = class extends IUseCase {
1072
+ constructor(eventRepository, memberRepository) {
1073
+ super();
1074
+ this.eventRepository = eventRepository;
1075
+ this.memberRepository = memberRepository;
1076
+ }
1077
+ async execute(input) {
1078
+ const event = await this.eventRepository.findById(input.eventId);
1079
+ if (!event) {
1080
+ throw new EventNotFoundException(input.eventId);
1081
+ }
1082
+ event.removeMemberId(input.memberId);
1083
+ await this.eventRepository.save(event);
1084
+ return { event };
1085
+ }
1086
+ };
1087
+
1088
+ // src/application/usecase/eventParticipation/GetEventsByMember.ts
1089
+ var GetEventsByMember = class extends IUseCase {
1090
+ constructor(eventRepository) {
1091
+ super();
1092
+ this.eventRepository = eventRepository;
1093
+ }
1094
+ async execute(input) {
1095
+ const events2 = await this.eventRepository.findByParticipantMemberId(
1096
+ input.memberId
1097
+ );
1098
+ return { events: events2 };
1099
+ }
1100
+ };
1101
+
1102
+ // src/application/usecase/eventParticipation/GetMembersByEvent.ts
1103
+ var GetMembersByEvent = class extends IUseCase {
1104
+ constructor(eventRepository, memberRepository) {
1105
+ super();
1106
+ this.eventRepository = eventRepository;
1107
+ this.memberRepository = memberRepository;
1108
+ }
1109
+ async execute(input) {
1110
+ const event = await this.eventRepository.findById(input.eventId);
1111
+ if (!event) {
1112
+ throw new EventNotFoundException(input.eventId);
1113
+ }
1114
+ const members2 = (await Promise.all(
1115
+ event.getMemberIds().map((memberId) => this.memberRepository.findById(memberId))
1116
+ )).filter((member) => member !== null);
1117
+ return { members: members2 };
1118
+ }
1119
+ };
1120
+
1121
+ // src/application/usecase/eventParticipation/RegisterMemberToExhibit.ts
1122
+ var RegisterMemberToExhibit = class extends IUseCase {
1123
+ constructor(eventRepository, memberRepository) {
1124
+ super();
1125
+ this.eventRepository = eventRepository;
1126
+ this.memberRepository = memberRepository;
1127
+ }
1128
+ async execute(input) {
1129
+ const event = await this.eventRepository.findByExhibitId(input.exhibitId);
1130
+ if (!event) {
1131
+ throw new EventNotFoundException(input.exhibitId);
1132
+ }
1133
+ const member = await this.memberRepository.findById(input.memberId);
1134
+ if (!member) {
1135
+ throw new MemberNotFoundException(input.memberId);
1136
+ }
1137
+ event.addExhibitMemberId(input.exhibitId, input.memberId);
1138
+ await this.eventRepository.save(event);
1139
+ return { event };
1140
+ }
1141
+ };
1142
+
1143
+ // src/application/usecase/eventParticipation/RemoveMemberFromExhibit.ts
1144
+ var RemoveMemberFromExhibit = class extends IUseCase {
1145
+ constructor(memberRepository, eventRepository) {
1146
+ super();
1147
+ this.memberRepository = memberRepository;
1148
+ this.eventRepository = eventRepository;
1149
+ }
1150
+ async execute(input) {
1151
+ const event = await this.eventRepository.findByExhibitId(input.exhibitId);
1152
+ if (!event) {
1153
+ throw new EventNotFoundException(input.exhibitId);
1154
+ }
1155
+ event.removeExhibitMemberId(input.exhibitId, input.memberId);
1156
+ await this.eventRepository.save(event);
1157
+ return { event };
1158
+ }
1159
+ };
1160
+
1161
+ // src/application/usecase/eventParticipation/GetExhibitsByMember.ts
1162
+ var GetExhibitsByMember = class extends IUseCase {
1163
+ constructor(eventRepository) {
1164
+ super();
1165
+ this.eventRepository = eventRepository;
1166
+ }
1167
+ async execute(input) {
1168
+ const events2 = await this.eventRepository.findByParticipantMemberId(
1169
+ input.memberId
1170
+ );
1171
+ const exhibits2 = [];
1172
+ for (const event of events2) {
1173
+ for (const exhibit of event.getExhibits()) {
1174
+ if (exhibit.getMemberIds().includes(input.memberId)) {
1175
+ exhibits2.push(exhibit);
1176
+ }
1177
+ }
1178
+ }
1179
+ return { exhibits: exhibits2 };
1180
+ }
1181
+ };
1182
+
1183
+ // src/application/usecase/eventParticipation/GetMembersByExhibit.ts
1184
+ var GetMembersByExhibit = class extends IUseCase {
1185
+ constructor(memberRepository, eventRepository) {
1186
+ super();
1187
+ this.memberRepository = memberRepository;
1188
+ this.eventRepository = eventRepository;
1189
+ }
1190
+ async execute(input) {
1191
+ const event = await this.eventRepository.findByExhibitId(input.exhibitId);
1192
+ if (!event) {
1193
+ throw new ExhibitNotFoundFromExhibitIdException(input.exhibitId);
1194
+ }
1195
+ const memberResults = await Promise.all(
1196
+ event.getMemberIds().map((memberId) => this.memberRepository.findById(memberId))
1197
+ );
1198
+ const members2 = memberResults.filter((m) => m !== null);
1199
+ return { members: members2 };
1200
+ }
1201
+ };
1202
+
1203
+ // src/infrastructure/drizzle/DrizzleMemberRepository.ts
1204
+ var import_drizzle_orm3 = require("drizzle-orm");
1205
+
1206
+ // src/infrastructure/drizzle/client.ts
1207
+ var import_node_postgres = require("drizzle-orm/node-postgres");
1208
+ var import_pg = require("pg");
1209
+
1210
+ // src/infrastructure/drizzle/schema.ts
1211
+ var schema_exports = {};
1212
+ __export(schema_exports, {
1213
+ discordAccounts: () => discordAccounts,
1214
+ discordAccountsRelations: () => discordAccountsRelations,
1215
+ events: () => events,
1216
+ eventsRelations: () => eventsRelations,
1217
+ exhibits: () => exhibits,
1218
+ exhibitsRelations: () => exhibitsRelations,
1219
+ lightningTalks: () => lightningTalks,
1220
+ lightningTalksRelations: () => lightningTalksRelations,
1221
+ memberEvents: () => memberEvents,
1222
+ memberEventsRelations: () => memberEventsRelations,
1223
+ memberExhibits: () => memberExhibits,
1224
+ memberExhibitsRelations: () => memberExhibitsRelations,
1225
+ members: () => members,
1226
+ membersRelations: () => membersRelations,
1227
+ prismaMigrations: () => prismaMigrations
1228
+ });
1229
+ var import_drizzle_orm = require("drizzle-orm");
1230
+ var import_drizzle_orm2 = require("drizzle-orm");
1231
+ var import_pg_core = require("drizzle-orm/pg-core");
1232
+ var members = (0, import_pg_core.pgTable)(
1233
+ "members",
1234
+ {
1235
+ id: (0, import_pg_core.text)().primaryKey().notNull(),
1236
+ name: (0, import_pg_core.text)().notNull(),
1237
+ studentId: (0, import_pg_core.text)("student_id").notNull(),
1238
+ department: (0, import_pg_core.text)().notNull(),
1239
+ email: (0, import_pg_core.text)().notNull(),
1240
+ personalEmail: (0, import_pg_core.text)("personal_email"),
1241
+ createdAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP`).notNull(),
1242
+ updatedAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull()
1243
+ },
1244
+ (table) => [
1245
+ (0, import_pg_core.uniqueIndex)("members_email_key").using(
1246
+ "btree",
1247
+ table.email.asc().nullsLast().op("text_ops")
1248
+ )
1249
+ ]
1250
+ );
1251
+ var discordAccounts = (0, import_pg_core.pgTable)(
1252
+ "discord_accounts",
1253
+ {
1254
+ discordId: (0, import_pg_core.text)("discord_id").primaryKey().notNull(),
1255
+ nickName: (0, import_pg_core.text)("nick_name").notNull(),
1256
+ memberId: (0, import_pg_core.text)("member_id").notNull(),
1257
+ createdAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP`).notNull(),
1258
+ updatedAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull()
1259
+ },
1260
+ (table) => [
1261
+ (0, import_pg_core.foreignKey)({
1262
+ columns: [table.memberId],
1263
+ foreignColumns: [members.id],
1264
+ name: "discord_accounts_member_id_fkey"
1265
+ }).onUpdate("cascade").onDelete("restrict")
1266
+ ]
1267
+ );
1268
+ var events = (0, import_pg_core.pgTable)("events", {
1269
+ id: (0, import_pg_core.text)().primaryKey().notNull(),
1270
+ name: (0, import_pg_core.text)().notNull(),
1271
+ date: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull(),
1272
+ createdAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP`).notNull(),
1273
+ updatedAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull()
1274
+ });
1275
+ var exhibits = (0, import_pg_core.pgTable)(
1276
+ "exhibits",
1277
+ {
1278
+ id: (0, import_pg_core.text)().primaryKey().notNull(),
1279
+ name: (0, import_pg_core.text)().notNull(),
1280
+ description: (0, import_pg_core.text)(),
1281
+ url: (0, import_pg_core.text)(),
1282
+ eventId: (0, import_pg_core.text)("event_id").notNull(),
1283
+ createdAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP`).notNull(),
1284
+ updatedAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull(),
1285
+ markdownContent: (0, import_pg_core.text)("markdown_content")
1286
+ },
1287
+ (table) => [
1288
+ (0, import_pg_core.foreignKey)({
1289
+ columns: [table.eventId],
1290
+ foreignColumns: [events.id],
1291
+ name: "exhibits_event_id_fkey"
1292
+ }).onUpdate("cascade").onDelete("restrict")
1293
+ ]
1294
+ );
1295
+ var lightningTalks = (0, import_pg_core.pgTable)(
1296
+ "lightning_talks",
1297
+ {
1298
+ exhibitId: (0, import_pg_core.text)("exhibit_id").primaryKey().notNull(),
1299
+ startTime: (0, import_pg_core.timestamp)("start_time", {
1300
+ precision: 3,
1301
+ mode: "string"
1302
+ }).notNull(),
1303
+ duration: (0, import_pg_core.integer)().notNull(),
1304
+ slideUrl: (0, import_pg_core.text)("slide_url"),
1305
+ createdAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP`).notNull(),
1306
+ updatedAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull()
1307
+ },
1308
+ (table) => [
1309
+ (0, import_pg_core.foreignKey)({
1310
+ columns: [table.exhibitId],
1311
+ foreignColumns: [exhibits.id],
1312
+ name: "lightning_talks_exhibit_id_fkey"
1313
+ }).onUpdate("cascade").onDelete("restrict")
1314
+ ]
1315
+ );
1316
+ var memberEvents = (0, import_pg_core.pgTable)(
1317
+ "member_events",
1318
+ {
1319
+ id: (0, import_pg_core.text)().primaryKey().notNull(),
1320
+ memberId: (0, import_pg_core.text)("member_id").notNull(),
1321
+ eventId: (0, import_pg_core.text)("event_id").notNull(),
1322
+ createdAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP`).notNull(),
1323
+ updatedAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull()
1324
+ },
1325
+ (table) => [
1326
+ (0, import_pg_core.uniqueIndex)("member_events_member_id_event_id_key").using(
1327
+ "btree",
1328
+ table.memberId.asc().nullsLast().op("text_ops"),
1329
+ table.eventId.asc().nullsLast().op("text_ops")
1330
+ ),
1331
+ (0, import_pg_core.foreignKey)({
1332
+ columns: [table.eventId],
1333
+ foreignColumns: [events.id],
1334
+ name: "member_events_event_id_fkey"
1335
+ }).onUpdate("cascade").onDelete("restrict"),
1336
+ (0, import_pg_core.foreignKey)({
1337
+ columns: [table.memberId],
1338
+ foreignColumns: [members.id],
1339
+ name: "member_events_member_id_fkey"
1340
+ }).onUpdate("cascade").onDelete("restrict")
1341
+ ]
1342
+ );
1343
+ var memberExhibits = (0, import_pg_core.pgTable)(
1344
+ "member_exhibits",
1345
+ {
1346
+ id: (0, import_pg_core.text)().primaryKey().notNull(),
1347
+ memberId: (0, import_pg_core.text)("member_id").notNull(),
1348
+ exhibitId: (0, import_pg_core.text)("exhibit_id").notNull(),
1349
+ createdAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP`).notNull(),
1350
+ updatedAt: (0, import_pg_core.timestamp)({ precision: 3, mode: "string" }).notNull()
1351
+ },
1352
+ (table) => [
1353
+ (0, import_pg_core.uniqueIndex)("member_exhibits_member_id_exhibit_id_key").using(
1354
+ "btree",
1355
+ table.memberId.asc().nullsLast().op("text_ops"),
1356
+ table.exhibitId.asc().nullsLast().op("text_ops")
1357
+ ),
1358
+ (0, import_pg_core.foreignKey)({
1359
+ columns: [table.exhibitId],
1360
+ foreignColumns: [exhibits.id],
1361
+ name: "member_exhibits_exhibit_id_fkey"
1362
+ }).onUpdate("cascade").onDelete("restrict"),
1363
+ (0, import_pg_core.foreignKey)({
1364
+ columns: [table.memberId],
1365
+ foreignColumns: [members.id],
1366
+ name: "member_exhibits_member_id_fkey"
1367
+ }).onUpdate("cascade").onDelete("restrict")
1368
+ ]
1369
+ );
1370
+ var prismaMigrations = (0, import_pg_core.pgTable)("_prisma_migrations", {
1371
+ id: (0, import_pg_core.varchar)({ length: 36 }).primaryKey().notNull(),
1372
+ checksum: (0, import_pg_core.varchar)({ length: 64 }).notNull(),
1373
+ finishedAt: (0, import_pg_core.timestamp)("finished_at", { withTimezone: true, mode: "string" }),
1374
+ migrationName: (0, import_pg_core.varchar)("migration_name", { length: 255 }).notNull(),
1375
+ logs: (0, import_pg_core.text)(),
1376
+ rolledBackAt: (0, import_pg_core.timestamp)("rolled_back_at", {
1377
+ withTimezone: true,
1378
+ mode: "string"
1379
+ }),
1380
+ startedAt: (0, import_pg_core.timestamp)("started_at", { withTimezone: true, mode: "string" }).defaultNow().notNull(),
1381
+ appliedStepsCount: (0, import_pg_core.integer)("applied_steps_count").default(0).notNull()
1382
+ });
1383
+ var membersRelations = (0, import_drizzle_orm.relations)(members, ({ many }) => ({
1384
+ discordAccounts: many(discordAccounts),
1385
+ memberEvents: many(memberEvents),
1386
+ memberExhibits: many(memberExhibits)
1387
+ }));
1388
+ var discordAccountsRelations = (0, import_drizzle_orm.relations)(
1389
+ discordAccounts,
1390
+ ({ one }) => ({
1391
+ member: one(members, {
1392
+ fields: [discordAccounts.memberId],
1393
+ references: [members.id]
1394
+ })
1395
+ })
1396
+ );
1397
+ var eventsRelations = (0, import_drizzle_orm.relations)(events, ({ many }) => ({
1398
+ memberEvents: many(memberEvents),
1399
+ exhibits: many(exhibits)
1400
+ }));
1401
+ var exhibitsRelations = (0, import_drizzle_orm.relations)(exhibits, ({ one, many }) => ({
1402
+ event: one(events, {
1403
+ fields: [exhibits.eventId],
1404
+ references: [events.id]
1405
+ }),
1406
+ lightningTalk: one(lightningTalks, {
1407
+ fields: [exhibits.id],
1408
+ references: [lightningTalks.exhibitId]
1409
+ }),
1410
+ memberExhibits: many(memberExhibits)
1411
+ }));
1412
+ var lightningTalksRelations = (0, import_drizzle_orm.relations)(lightningTalks, ({ one }) => ({
1413
+ exhibit: one(exhibits, {
1414
+ fields: [lightningTalks.exhibitId],
1415
+ references: [exhibits.id]
1416
+ })
1417
+ }));
1418
+ var memberEventsRelations = (0, import_drizzle_orm.relations)(memberEvents, ({ one }) => ({
1419
+ member: one(members, {
1420
+ fields: [memberEvents.memberId],
1421
+ references: [members.id]
1422
+ }),
1423
+ event: one(events, {
1424
+ fields: [memberEvents.eventId],
1425
+ references: [events.id]
1426
+ })
1427
+ }));
1428
+ var memberExhibitsRelations = (0, import_drizzle_orm.relations)(memberExhibits, ({ one }) => ({
1429
+ member: one(members, {
1430
+ fields: [memberExhibits.memberId],
1431
+ references: [members.id]
1432
+ }),
1433
+ exhibit: one(exhibits, {
1434
+ fields: [memberExhibits.exhibitId],
1435
+ references: [exhibits.id]
1436
+ })
1437
+ }));
1438
+
1439
+ // src/infrastructure/drizzle/client.ts
1440
+ var pool = null;
1441
+ function getPool() {
1442
+ if (!pool) {
1443
+ const connectionString = process.env.DATABASE_URL;
1444
+ if (!connectionString) {
1445
+ throw new Error("DATABASE_URL environment variable is not set");
1446
+ }
1447
+ pool = new import_pg.Pool({ connectionString });
1448
+ }
1449
+ return pool;
1450
+ }
1451
+ function getDb() {
1452
+ return (0, import_node_postgres.drizzle)(getPool(), { schema: schema_exports });
1453
+ }
1454
+
1455
+ // src/infrastructure/drizzle/DrizzleMemberRepository.ts
1456
+ var DrizzleMemberRepository = class {
1457
+ /**
1458
+ * Converts a database record to a domain Member entity.
1459
+ * Accepts the exact type returned by Drizzle's relational query.
1460
+ */
1461
+ toDomain(record) {
1462
+ const member = new Member(
1463
+ record.id,
1464
+ record.name,
1465
+ record.studentId,
1466
+ Department.fromString(record.department),
1467
+ new UniversityEmail(record.email),
1468
+ record.personalEmail ? new Email(record.personalEmail) : void 0
1469
+ );
1470
+ for (const discordAccount of record.discordAccounts) {
1471
+ member.addDiscordAccount(
1472
+ new DiscordAccount(
1473
+ discordAccount.discordId,
1474
+ discordAccount.nickName,
1475
+ discordAccount.memberId
1476
+ )
1477
+ );
1478
+ }
1479
+ return member;
1480
+ }
1481
+ // ==========================================================================
1482
+ // Query Methods
1483
+ // ==========================================================================
1484
+ async findByDiscordAccountId(discordAccountId) {
1485
+ const db = getDb();
1486
+ const discordAccount = await db.query.discordAccounts.findFirst({
1487
+ where: (0, import_drizzle_orm3.eq)(discordAccounts.discordId, discordAccountId)
1488
+ });
1489
+ if (!discordAccount) return null;
1490
+ return this.findById(discordAccount.memberId);
1491
+ }
1492
+ async findById(id) {
1493
+ const db = getDb();
1494
+ const record = await db.query.members.findFirst({
1495
+ where: (0, import_drizzle_orm3.eq)(members.id, id),
1496
+ with: { discordAccounts: true }
1497
+ });
1498
+ if (!record) return null;
1499
+ return this.toDomain(record);
1500
+ }
1501
+ async findByEmail(email) {
1502
+ const db = getDb();
1503
+ const record = await db.query.members.findFirst({
1504
+ where: (0, import_drizzle_orm3.eq)(members.email, email),
1505
+ with: { discordAccounts: true }
1506
+ });
1507
+ if (!record) return null;
1508
+ return this.toDomain(record);
1509
+ }
1510
+ async findByStudentId(studentId) {
1511
+ const db = getDb();
1512
+ const record = await db.query.members.findFirst({
1513
+ where: (0, import_drizzle_orm3.eq)(members.studentId, studentId),
1514
+ with: { discordAccounts: true }
1515
+ });
1516
+ if (!record) return null;
1517
+ return this.toDomain(record);
1518
+ }
1519
+ async findAll() {
1520
+ const db = getDb();
1521
+ const records = await db.query.members.findMany({
1522
+ with: { discordAccounts: true }
1523
+ });
1524
+ return records.map((record) => this.toDomain(record));
1525
+ }
1526
+ // ==========================================================================
1527
+ // Persistence Methods
1528
+ // ==========================================================================
1529
+ async save(member) {
1530
+ const db = getDb();
1531
+ const snapshot = member.toSnapshot();
1532
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1533
+ await db.insert(members).values({
1534
+ id: snapshot.id,
1535
+ name: snapshot.name,
1536
+ studentId: snapshot.studentId,
1537
+ department: snapshot.department.getValue(),
1538
+ email: snapshot.email.getValue(),
1539
+ personalEmail: snapshot.personalEmail?.getValue() ?? null,
1540
+ updatedAt: now
1541
+ }).onConflictDoUpdate({
1542
+ target: members.id,
1543
+ set: {
1544
+ name: snapshot.name,
1545
+ studentId: snapshot.studentId,
1546
+ department: snapshot.department.getValue(),
1547
+ email: snapshot.email.getValue(),
1548
+ personalEmail: snapshot.personalEmail?.getValue() ?? null,
1549
+ updatedAt: now
1550
+ }
1551
+ });
1552
+ for (const discordAccount of snapshot.discordAccounts) {
1553
+ await db.insert(discordAccounts).values({
1554
+ discordId: discordAccount.id,
1555
+ nickName: discordAccount.nickName,
1556
+ memberId: discordAccount.memberId,
1557
+ updatedAt: now
1558
+ }).onConflictDoUpdate({
1559
+ target: discordAccounts.discordId,
1560
+ set: {
1561
+ nickName: discordAccount.nickName,
1562
+ updatedAt: now
1563
+ }
1564
+ });
1565
+ }
1566
+ }
1567
+ async delete(memberId) {
1568
+ const db = getDb();
1569
+ await db.delete(discordAccounts).where((0, import_drizzle_orm3.eq)(discordAccounts.memberId, memberId));
1570
+ await db.delete(members).where((0, import_drizzle_orm3.eq)(members.id, memberId));
1571
+ }
1572
+ };
1573
+
1574
+ // src/infrastructure/drizzle/DrizzleEventRepository.ts
1575
+ var import_node_crypto = require("crypto");
1576
+ var import_drizzle_orm4 = require("drizzle-orm");
1577
+ var DrizzleEventRepository = class {
1578
+ /**
1579
+ * Converts a database record to a domain Event entity.
1580
+ */
1581
+ toDomain(record) {
1582
+ const event = new Event(record.id, record.name, new Date(record.date));
1583
+ for (const memberEvent of record.memberEvents) {
1584
+ event.addMemberId(memberEvent.memberId);
1585
+ }
1586
+ for (const exhibitRecord of record.exhibits) {
1587
+ const exhibit = this.createExhibitFromRecord(exhibitRecord);
1588
+ for (const memberExhibit of exhibitRecord.memberExhibits) {
1589
+ exhibit.addMemberId(memberExhibit.memberId);
1590
+ }
1591
+ event.addExhibit(exhibit);
1592
+ }
1593
+ return event;
1594
+ }
1595
+ /**
1596
+ * Creates an Exhibit domain entity from a database record.
1597
+ */
1598
+ createExhibitFromRecord(record) {
1599
+ if (record.lightningTalk) {
1600
+ const lt = record.lightningTalk;
1601
+ const lightningTalk = new LightningTalk(
1602
+ lt.exhibitId,
1603
+ new Date(lt.startTime),
1604
+ new LightningTalkDuration(lt.duration),
1605
+ lt.slideUrl ? new Url(lt.slideUrl) : void 0
1606
+ );
1607
+ return Exhibit.createWithLightningTalk(
1608
+ record.id,
1609
+ record.name,
1610
+ lightningTalk,
1611
+ record.description ?? void 0,
1612
+ record.markdownContent ?? void 0,
1613
+ record.url ? new Url(record.url) : void 0
1614
+ );
1615
+ }
1616
+ return new Exhibit(
1617
+ record.id,
1618
+ record.name,
1619
+ record.description ?? void 0,
1620
+ record.markdownContent ?? void 0,
1621
+ record.url ? new Url(record.url) : void 0
1622
+ );
1623
+ }
1624
+ // ==========================================================================
1625
+ // Persistence Methods
1626
+ // ==========================================================================
1627
+ async persistEvent(event) {
1628
+ const db = getDb();
1629
+ const snapshot = event.toSnapshot();
1630
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1631
+ const dateStr = snapshot.date instanceof Date ? snapshot.date.toISOString() : snapshot.date;
1632
+ await db.insert(events).values({
1633
+ id: snapshot.id,
1634
+ name: snapshot.name,
1635
+ date: dateStr,
1636
+ updatedAt: now
1637
+ }).onConflictDoUpdate({
1638
+ target: events.id,
1639
+ set: {
1640
+ name: snapshot.name,
1641
+ date: dateStr,
1642
+ updatedAt: now
1643
+ }
1644
+ });
1645
+ const snapshotExhibitIds = snapshot.exhibits.map((ex) => ex.id);
1646
+ await this.deleteObsoleteExhibits(db, snapshot.id, snapshotExhibitIds);
1647
+ for (const ex of snapshot.exhibits) {
1648
+ await this.upsertExhibit(db, snapshot.id, ex);
1649
+ }
1650
+ await this.syncMemberEvents(db, snapshot.id, event.getMemberIds());
1651
+ for (const exhibitDomain of event.getExhibits()) {
1652
+ await this.syncMemberExhibits(
1653
+ db,
1654
+ exhibitDomain.id,
1655
+ exhibitDomain.getMemberIds()
1656
+ );
1657
+ }
1658
+ }
1659
+ async deleteObsoleteExhibits(db, eventId, keptExhibitIds) {
1660
+ const existingExhibits = await db.select({ id: exhibits.id }).from(exhibits).where((0, import_drizzle_orm4.eq)(exhibits.eventId, eventId));
1661
+ const existingIdSet = new Set(existingExhibits.map((r) => r.id));
1662
+ const keptIdSet = new Set(keptExhibitIds);
1663
+ const obsoleteIds = [...existingIdSet].filter((id) => !keptIdSet.has(id));
1664
+ if (obsoleteIds.length > 0) {
1665
+ await db.delete(lightningTalks).where((0, import_drizzle_orm4.inArray)(lightningTalks.exhibitId, obsoleteIds));
1666
+ await db.delete(memberExhibits).where((0, import_drizzle_orm4.inArray)(memberExhibits.exhibitId, obsoleteIds));
1667
+ await db.delete(exhibits).where((0, import_drizzle_orm4.inArray)(exhibits.id, obsoleteIds));
1668
+ }
1669
+ }
1670
+ async upsertExhibit(db, eventId, ex) {
1671
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1672
+ await db.insert(exhibits).values({
1673
+ id: ex.id,
1674
+ name: ex.name,
1675
+ description: ex.description ?? null,
1676
+ markdownContent: ex.markdownContent ?? null,
1677
+ url: ex.url?.getValue() ?? null,
1678
+ eventId,
1679
+ updatedAt: now
1680
+ }).onConflictDoUpdate({
1681
+ target: exhibits.id,
1682
+ set: {
1683
+ name: ex.name,
1684
+ description: ex.description ?? null,
1685
+ markdownContent: ex.markdownContent ?? null,
1686
+ url: ex.url?.getValue() ?? null,
1687
+ updatedAt: now
1688
+ }
1689
+ });
1690
+ if (ex.lightningTalk) {
1691
+ const startTimeStr = ex.lightningTalk.startTime instanceof Date ? ex.lightningTalk.startTime.toISOString() : ex.lightningTalk.startTime;
1692
+ await db.insert(lightningTalks).values({
1693
+ exhibitId: ex.id,
1694
+ startTime: startTimeStr,
1695
+ duration: ex.lightningTalk.durationMinutes.getValue(),
1696
+ slideUrl: ex.lightningTalk.slideUrl?.getValue() ?? null,
1697
+ updatedAt: now
1698
+ }).onConflictDoUpdate({
1699
+ target: lightningTalks.exhibitId,
1700
+ set: {
1701
+ startTime: startTimeStr,
1702
+ duration: ex.lightningTalk.durationMinutes.getValue(),
1703
+ slideUrl: ex.lightningTalk.slideUrl?.getValue() ?? null,
1704
+ updatedAt: now
1705
+ }
1706
+ });
1707
+ } else {
1708
+ await db.delete(lightningTalks).where((0, import_drizzle_orm4.eq)(lightningTalks.exhibitId, ex.id));
1709
+ }
1710
+ }
1711
+ async syncMemberEvents(db, eventId, memberIds) {
1712
+ await db.delete(memberEvents).where((0, import_drizzle_orm4.eq)(memberEvents.eventId, eventId));
1713
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1714
+ for (const memberId of memberIds) {
1715
+ await db.insert(memberEvents).values({
1716
+ id: (0, import_node_crypto.randomUUID)(),
1717
+ memberId,
1718
+ eventId,
1719
+ updatedAt: now
1720
+ }).onConflictDoNothing();
1721
+ }
1722
+ }
1723
+ async syncMemberExhibits(db, exhibitId, memberIds) {
1724
+ await db.delete(memberExhibits).where((0, import_drizzle_orm4.eq)(memberExhibits.exhibitId, exhibitId));
1725
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1726
+ for (const memberId of memberIds) {
1727
+ await db.insert(memberExhibits).values({
1728
+ id: (0, import_node_crypto.randomUUID)(),
1729
+ memberId,
1730
+ exhibitId,
1731
+ updatedAt: now
1732
+ }).onConflictDoNothing();
1733
+ }
1734
+ }
1735
+ // ==========================================================================
1736
+ // Query Methods
1737
+ // ==========================================================================
1738
+ async findById(id) {
1739
+ const db = getDb();
1740
+ const record = await db.query.events.findFirst({
1741
+ where: (0, import_drizzle_orm4.eq)(events.id, id),
1742
+ with: {
1743
+ memberEvents: true,
1744
+ exhibits: {
1745
+ with: {
1746
+ lightningTalk: true,
1747
+ memberExhibits: true
1748
+ }
1749
+ }
1750
+ }
1751
+ });
1752
+ if (!record) return null;
1753
+ return this.toDomain(record);
1754
+ }
1755
+ async findByParticipantMemberId(memberId) {
1756
+ const db = getDb();
1757
+ const participations = await db.select({ eventId: memberEvents.eventId }).from(memberEvents).where((0, import_drizzle_orm4.eq)(memberEvents.memberId, memberId));
1758
+ if (participations.length === 0) return [];
1759
+ const eventIds = participations.map((p) => p.eventId);
1760
+ const records = await db.query.events.findMany({
1761
+ where: (0, import_drizzle_orm4.inArray)(events.id, eventIds),
1762
+ with: {
1763
+ memberEvents: true,
1764
+ exhibits: {
1765
+ with: {
1766
+ lightningTalk: true,
1767
+ memberExhibits: true
1768
+ }
1769
+ }
1770
+ }
1771
+ });
1772
+ return records.map((r) => this.toDomain(r));
1773
+ }
1774
+ async findByExhibitId(exhibitId) {
1775
+ const db = getDb();
1776
+ const exhibit = await db.select({ eventId: exhibits.eventId }).from(exhibits).where((0, import_drizzle_orm4.eq)(exhibits.id, exhibitId)).limit(1);
1777
+ if (exhibit.length === 0) return null;
1778
+ return this.findById(exhibit[0].eventId);
1779
+ }
1780
+ async findAll() {
1781
+ const db = getDb();
1782
+ const records = await db.query.events.findMany({
1783
+ with: {
1784
+ memberEvents: true,
1785
+ exhibits: {
1786
+ with: {
1787
+ lightningTalk: true,
1788
+ memberExhibits: true
1789
+ }
1790
+ }
1791
+ }
1792
+ });
1793
+ return records.map((r) => this.toDomain(r));
1794
+ }
1795
+ async save(event) {
1796
+ await this.persistEvent(event);
1797
+ }
1798
+ async delete(eventId) {
1799
+ const db = getDb();
1800
+ const exhibitRecords = await db.select({ id: exhibits.id }).from(exhibits).where((0, import_drizzle_orm4.eq)(exhibits.eventId, eventId));
1801
+ const exhibitIds = exhibitRecords.map((ex) => ex.id);
1802
+ if (exhibitIds.length > 0) {
1803
+ await db.delete(lightningTalks).where((0, import_drizzle_orm4.inArray)(lightningTalks.exhibitId, exhibitIds));
1804
+ await db.delete(memberExhibits).where((0, import_drizzle_orm4.inArray)(memberExhibits.exhibitId, exhibitIds));
1805
+ }
1806
+ await db.delete(memberEvents).where((0, import_drizzle_orm4.eq)(memberEvents.eventId, eventId));
1807
+ await db.delete(exhibits).where((0, import_drizzle_orm4.eq)(exhibits.eventId, eventId));
1808
+ await db.delete(events).where((0, import_drizzle_orm4.eq)(events.id, eventId));
1809
+ }
1810
+ };
1811
+
1812
+ // src/executable/member.ts
1813
+ function createMemberUseCases() {
1814
+ const memberRepo = new DrizzleMemberRepository();
1815
+ return {
1816
+ registerMember: new RegisterMemberUseCase(memberRepo),
1817
+ updateMember: new UpdateMemberUseCase(memberRepo),
1818
+ getMember: new GetMemberUseCase(memberRepo),
1819
+ getMemberByDiscordId: new GetMemberByDiscordIdUseCase(memberRepo),
1820
+ getMemberByEmail: new GetMemberByEmailUseCase(memberRepo),
1821
+ getMemberList: new GetMemberListUseCase(memberRepo),
1822
+ changeDiscordNickName: new ChangeDiscordNickNameUseCase(memberRepo),
1823
+ connectDiscordAccount: new ConnectDiscordAccountUseCase(memberRepo)
1824
+ };
1825
+ }
1826
+
1827
+ // src/executable/event.ts
1828
+ function createEventUseCases() {
1829
+ const eventRepo = new DrizzleEventRepository();
1830
+ const memberRepo = new DrizzleMemberRepository();
1831
+ return {
1832
+ createEvent: new CreateEvent(eventRepo),
1833
+ updateEvent: new UpdateEvent(eventRepo),
1834
+ deleteEvent: new DeleteEvent(eventRepo),
1835
+ getEvent: new GetEvent(eventRepo),
1836
+ getEventList: new GetEventList(eventRepo),
1837
+ addExhibitToEvent: new AddExhibitToEvent(eventRepo),
1838
+ changeExhibitDescription: new ChangeExhibitDescription(
1839
+ eventRepo
1840
+ ),
1841
+ changeExhibitMarkdownContent: new ChangeExhibitMarkdownContent(eventRepo),
1842
+ changeExhibitName: new ChangeExhibitName(eventRepo),
1843
+ changeExhibitUrl: new ChangeExhibitUrl(eventRepo),
1844
+ changeLightningTalkDuration: new ChangeLightningTalkDuration(
1845
+ eventRepo
1846
+ ),
1847
+ changeLightningTalkSlideUrl: new ChangeLightningTalkSlideUrl(
1848
+ eventRepo
1849
+ ),
1850
+ changeLightningTalkStartTime: new ChangeLightningTalkStartTime(eventRepo),
1851
+ removeExhibitFromEvent: new RemoveExhibitFromEvent(eventRepo),
1852
+ registerMemberToEvent: new RegisterMemberToEvent(
1853
+ eventRepo,
1854
+ memberRepo
1855
+ ),
1856
+ removeMemberFromEvent: new RemoveMemberFromEvent(
1857
+ eventRepo,
1858
+ memberRepo
1859
+ ),
1860
+ getEventsByMember: new GetEventsByMember(
1861
+ eventRepo
1862
+ ),
1863
+ getMembersByEvent: new GetMembersByEvent(
1864
+ eventRepo,
1865
+ memberRepo
1866
+ ),
1867
+ registerMemberToExhibit: new RegisterMemberToExhibit(
1868
+ eventRepo,
1869
+ memberRepo
1870
+ ),
1871
+ removeMemberFromExhibit: new RemoveMemberFromExhibit(
1872
+ memberRepo,
1873
+ eventRepo
1874
+ ),
1875
+ getExhibitsByMember: new GetExhibitsByMember(
1876
+ eventRepo
1877
+ ),
1878
+ getMembersByExhibit: new GetMembersByExhibit(
1879
+ memberRepo,
1880
+ eventRepo
1881
+ )
1882
+ };
1883
+ }
1884
+ // Annotate the CommonJS export names for ESM import in node:
1885
+ 0 && (module.exports = {
1886
+ Department,
1887
+ DiscordAccount,
1888
+ DiscordAccountAlreadyConnectedException,
1889
+ DiscordAccountNotConnectedException,
1890
+ DomainException,
1891
+ Email,
1892
+ Event,
1893
+ Exhibit,
1894
+ ExhibitAlreadyExistsException,
1895
+ ExhibitHasMemberException,
1896
+ ExhibitNotFoundException,
1897
+ InvalidDepartmentException,
1898
+ InvalidEmailFormatException,
1899
+ InvalidLightningTalkDurationException,
1900
+ InvalidUniversityEmailException,
1901
+ InvalidUrlException,
1902
+ InvalidUrlProtocolException,
1903
+ LightningTalk,
1904
+ LightningTalkDuration,
1905
+ LightningTalkExhibitIdMismatchException,
1906
+ LightningTalkNotFoundException,
1907
+ Member,
1908
+ UniversityEmail,
1909
+ Url,
1910
+ ValueObject,
1911
+ createEventUseCases,
1912
+ createMemberUseCases
1913
+ });
1914
+ //# sourceMappingURL=index.cjs.map