inmemory to postgres
This commit is contained in:
@@ -62,6 +62,31 @@ export class Sponsor implements IEntity<SponsorId> {
|
||||
});
|
||||
}
|
||||
|
||||
static rehydrate(props: {
|
||||
id: string;
|
||||
name: string;
|
||||
contactEmail: string;
|
||||
logoUrl?: string;
|
||||
websiteUrl?: string;
|
||||
createdAt: Date;
|
||||
}): Sponsor {
|
||||
const id = SponsorId.create(props.id);
|
||||
const name = SponsorName.create(props.name);
|
||||
const contactEmail = SponsorEmail.create(props.contactEmail);
|
||||
const logoUrl = props.logoUrl ? Url.create(props.logoUrl) : undefined;
|
||||
const websiteUrl = props.websiteUrl ? Url.create(props.websiteUrl) : undefined;
|
||||
const createdAt = SponsorCreatedAt.create(props.createdAt);
|
||||
|
||||
return new Sponsor({
|
||||
id,
|
||||
name,
|
||||
contactEmail,
|
||||
createdAt,
|
||||
...(logoUrl !== undefined ? { logoUrl } : {}),
|
||||
...(websiteUrl !== undefined ? { websiteUrl } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update sponsor information
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user