Add base app
This commit is contained in:
23
components/domain/wishes/models.ts
Normal file
23
components/domain/wishes/models.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { result } from '../../common/result'
|
||||
|
||||
export type Wish = {
|
||||
name: string
|
||||
description?: string
|
||||
link?: string
|
||||
}
|
||||
|
||||
export const createWish = (
|
||||
name: string,
|
||||
description?: string,
|
||||
link?: string
|
||||
): result.Result<Wish, string> => {
|
||||
if (typeof name !== 'undefined' && name.length > 0) {
|
||||
return result.ok({
|
||||
name,
|
||||
description,
|
||||
link,
|
||||
} as Wish)
|
||||
}
|
||||
|
||||
return result.err(`validation of wish failed via. createWish`)
|
||||
}
|
Reference in New Issue
Block a user