Skip to content

Commit

Permalink
Add creatorId to resource
Browse files Browse the repository at this point in the history
  • Loading branch information
frenkzcom committed Oct 5, 2022
1 parent 4c5fa0e commit 17f4e5b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/application/command/create-resource.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class CreateResourceHandler
parentType: command.parentType
? (command.parentType as ResourceParentType)
: undefined,
creatorId: new UUID(command.creatorId),
},
command.id ? new UUID(command.id) : undefined
);
Expand Down
1 change: 1 addition & 0 deletions src/application/command/dto/create-resource.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class CreateResourceCommand extends Command {
readonly type!: string;
readonly parentId?: string;
readonly parentType?: string;
readonly creatorId!: string;
readonly id?: string;
readonly clientCreatedAt?: Date;
}
4 changes: 4 additions & 0 deletions src/domain/resource/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export class Resource extends AggregateRoot<ResourceProps> {
return this.props.parentType;
}

get creatorId(): UUID {
return this.props.creatorId;
}

get clientCreatedAt(): DateVO {
return this.props.clientCreatedAt;
}
Expand Down
1 change: 1 addition & 0 deletions src/domain/resource/resource.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface CreateResourceProps {
parentId?: UUID;
parentType?: ResourceParentType;
clientCreatedAt?: DateVO;
creatorId: UUID;
}

export interface ResourceProps extends CreateResourceProps {
Expand Down

0 comments on commit 17f4e5b

Please sign in to comment.