Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/domain/aggregates/event/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import {
ExhibitHasMemberException,
ExhibitNotFoundException,
} from "#domain/exceptions";
import type { LightningTalkDuration, Url } from "#domain/value-objects";
import type { Exhibit } from "./Exhibit";
import type { LightningTalkDuration } from "./LightningTalkDuration";
import type { Url } from "./Url";

export class Event {
private exhibits: Exhibit[] = [];
Expand Down
3 changes: 2 additions & 1 deletion src/domain/aggregates/event/Exhibit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import {
LightningTalkExhibitIdMismatchException,
LightningTalkNotFoundException,
} from "#domain/exceptions";
import type { LightningTalkDuration, Url } from "#domain/value-objects";
import type { LightningTalk } from "./LightningTalk";
import type { LightningTalkDuration } from "./LightningTalkDuration";
import type { Url } from "./Url";
export class Exhibit {
private lightningTalk?: LightningTalk;
private memberIds: Set<string> = new Set();
Expand Down
3 changes: 2 additions & 1 deletion src/domain/aggregates/event/LightningTalk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { LightningTalkDuration, Url } from "#domain/value-objects";
import type { LightningTalkDuration } from "./LightningTalkDuration";
import type { Url } from "./Url";

export class LightningTalk {
constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ValueObject } from "#domain/base/ValueObject";
import { InvalidLightningTalkDurationException } from "#domain/exceptions";
import { ValueObject } from "./ValueObject";

export class LightningTalkDuration extends ValueObject<number> {
protected validate(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ValueObject } from "#domain/base/ValueObject";
import {
InvalidUrlException,
InvalidUrlProtocolException,
} from "#domain/exceptions";
import { ValueObject } from "./ValueObject";

export class Url extends ValueObject<string> {
protected validate(): void {
Expand Down
2 changes: 2 additions & 0 deletions src/domain/aggregates/event/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ export * from "./Event";
export * from "./EventRepository";
export * from "./Exhibit";
export * from "./LightningTalk";
export * from "./LightningTalkDuration";
export * from "./Url";
Comment on lines +5 to +6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Url and LightningTalkDuration are now scoped to the event aggregate

By moving Url into domain/aggregates/event/Url.ts and LightningTalkDuration into domain/aggregates/event/LightningTalkDuration.ts, these value objects are now conceptually part of the event aggregate. Currently no other aggregate uses Url or LightningTalkDuration, so this is fine. However, if a future aggregate (e.g., member) needs a Url value object, importing it from the event aggregate would create a cross-aggregate dependency, which is a DDD anti-pattern. The previous shared value-objects location avoided this. This is a design trade-off worth being aware of — if Url is a general-purpose value object, it might belong in domain/base/ alongside ValueObject.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ValueObject } from "#domain/base/ValueObject";
import { InvalidDepartmentException } from "#domain/exceptions";
import { ValueObject } from "./ValueObject";

type AllowedDepartment = "CS" | "BI" | "IA" | "GRADUATE" | "ALUMNI" | "OTHERS";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ValueObject } from "#domain/base/ValueObject";
import { InvalidEmailFormatException } from "#domain/exceptions";
import { ValueObject } from "./ValueObject";

export class Email extends ValueObject<string> {
protected validate(): void {
Expand Down
4 changes: 3 additions & 1 deletion src/domain/aggregates/member/Member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import {
DiscordAccountAlreadyConnectedException,
DiscordAccountNotConnectedException,
} from "#domain/exceptions";
import type { Department, Email, UniversityEmail } from "#domain/value-objects";
import type { Department } from "./Departments";
import type { DiscordAccount } from "./DiscordAccount";
import type { Email } from "./Email";
import type { UniversityEmail } from "./UniversityEmail";

export class Member {
private discordAccounts: DiscordAccount[] = [];
Expand Down
3 changes: 3 additions & 0 deletions src/domain/aggregates/member/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export * from "./Member";
export * from "./MemberRepository";
export * from "./DiscordAccount";
export * from "./Departments";
export * from "./Email";
export * from "./UniversityEmail";
File renamed without changes.
1 change: 1 addition & 0 deletions src/domain/base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ValueObject";
2 changes: 1 addition & 1 deletion src/domain/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./value-objects";
export * from "./base";
export * from "./exceptions";
export * from "./aggregates";
6 changes: 0 additions & 6 deletions src/domain/value-objects/index.ts

This file was deleted.

Loading