-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModel.idr
More file actions
65 lines (45 loc) · 1.32 KB
/
Model.idr
File metadata and controls
65 lines (45 loc) · 1.32 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
module Examples.Model
import Language.Reflection
%language ElabReflection
Time : Type
Id : Type -> Type
record User where
constructor MkUser
id : Id User
email, token, username, bio, image : String
record Article where
constructor MkArticle
id : Id Article
slug, title, description, body : String
createdAt, updatedAt : Time
author : Id User
record Comment where
constructor MkComment
id : Id Comment
createdAt, updatedAt : Time
body : String
author : Id User
record Favorite where
constructor MkFavorite
id : Id Favorite
user : Id User
article : Id Article
record Tag where
constructor MkTag
id : Id Tag
article : Id Article
tag : String
-- %runElab derive "User" [Generic, Meta, Eq, Ord, DecEq, Show, Db ]
-- %runElab derive "Profile" [Generic, Meta, Eq, Ord, DecEq, Show ]
-- %runElab derive "Article" [Generic, Meta, Eq, Ord, DecEq, Show, Db ]
-- %runElab derive "Comment" [Generic, Meta, Eq, Ord, DecEq, Show, Db ]
-- %runElab derive "Favorite" [Generic, Meta, Eq, Ord, DecEq, Show, Db ]
-- %runElab derive "Tag" [Generic, Meta, Eq, Ord, DecEq, Show, Db ]
interface Db t where
get : Id t -> Db t
create : t -> Db t
update : Id t -> t -> Db t
delete : Id t -> Db ()
db : List String
db =
[ "users", "articles", "comments" ]