27 lines
479 B
TypeScript
27 lines
479 B
TypeScript
import { result } from '../../common/result'
|
|
|
|
export type Wish = {
|
|
id: string
|
|
name: string
|
|
description?: string
|
|
link?: string
|
|
}
|
|
|
|
export const createWish = (
|
|
id: string,
|
|
name: string,
|
|
description: string = '',
|
|
link: string = ''
|
|
): result.Result<Wish, string> => {
|
|
if (typeof name !== 'undefined') {
|
|
return result.ok({
|
|
id,
|
|
name,
|
|
description,
|
|
link,
|
|
} as Wish)
|
|
}
|
|
|
|
return result.err(`validation of wish failed via. createWish`)
|
|
}
|