forked from effect-app/boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlog.ts
More file actions
26 lines (23 loc) · 783 Bytes
/
Blog.ts
File metadata and controls
26 lines (23 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { S } from "effect-app"
import { UserFromId } from "./User.js"
export const BlogPostId = S.prefixedStringId<BlogPostId>()("post", "BlogPostId")
export interface BlogPostIdBrand {
readonly BlogPostId: unique symbol
}
export type BlogPostId = S.StringId & BlogPostIdBrand & `post-${string}`
export class BlogPost extends S.ExtendedClass<BlogPost, BlogPost.Encoded>()({
id: BlogPostId.withDefault,
title: S.NonEmptyString255,
body: S.NonEmptyString2k,
createdAt: S.Date.withDefault,
author: S.propertySignature(UserFromId).pipe(S.fromKey("authorId"))
}) {}
// codegen:start {preset: model}
//
/* eslint-disable */
export namespace BlogPost {
export interface Encoded extends S.Struct.Encoded<typeof BlogPost["fields"]> {}
}
/* eslint-enable */
//
// codegen:end