-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
27,399 additions
and
2,189 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { v4 as uuid } from 'uuid' | ||
|
||
export default class BookId { | ||
constructor(public readonly value: string) {} | ||
|
||
static generate(): BookId { | ||
return new BookId(uuid()) | ||
} | ||
|
||
public static with(id: string): BookId { | ||
return new BookId(id) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export class BookTitle { | ||
constructor(public readonly value: string) {} | ||
|
||
public static with(title: string): BookTitle { | ||
if (title === undefined) { | ||
throw Error('Title can not be undefined') | ||
} | ||
if (title.length < 3) { | ||
throw Error('Title is too short') | ||
} | ||
|
||
return new BookTitle(title) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default interface Books { | ||
// Saves a user | ||
//save(book: Book): Promise<void> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
export async function createBook( | ||
title:string, | ||
authors:string[], | ||
image:string, | ||
): | ||
Promise<void>{ | ||
const id = BookId.generate(); | ||
const result = await container.createBook.with(new CreateBookCommand(id.value,title,authors,image)); | ||
} | ||
*/ |