-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.wasp
More file actions
109 lines (97 loc) · 2.69 KB
/
main.wasp
File metadata and controls
109 lines (97 loc) · 2.69 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
app StorAI {
wasp: {
version: "^0.10.3"
},
db: {
system: PostgreSQL,
},
title: "StorAI",
dependencies: [
("json5", "2.2.3"),
("prettier", "2.8.8"),
("node-fetch", "3.3.1"),
("langchain", "0.0.68")
],
auth: {
// Expects entity User to have (username:String) and (password:String) fields.
userEntity: User,
methods: {
// We also support Google and GitHub, with more on the way!
usernameAndPassword: {}
},
// We'll see how this is used a bit later
onAuthFailedRedirectTo: "/login"
}
}
route RootRoute { path: "/", to: MainPage }
page MainPage {
authRequired: true,
component: import Main from "@client/MainPage.tsx"
}
route CreateCharacterRoute { path: "/create", to: CreateCharacter }
page CreateCharacter {
authRequired: true,
component: import CreateCharacter from "@client/CreateCharacter.tsx"
}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import Signup from "@client/SignupPage"
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import Login from "@client/LoginPage"
}
query getCharacter {
fn: import { getCharacter } from "@server/queries.js",
entities: [Character, History]
}
action createCharacter {
fn: import { createCharacter } from "@server/actions.js",
entities: [Character]
}
action abandonCharacter {
fn: import { abandonCharacter } from "@server/actions.js",
entities: [Character]
}
action damage {
fn: import { damage } from "@server/actions.js",
entities: [Character]
}
action sendCommand {
fn: import { sendCommand } from "@server/actions.js",
entities: [Character, History]
}
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
password String
created_at DateTime @default(now())
characters Character[]?
psl=}
entity Character {=psl
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
name String
active Boolean @default(true)
health_head Int
health_body Int
health_leftArm Int
health_rightArm Int
health_leftLeg Int
health_rightLeg Int
created_at DateTime @default(now())
room_history History[]
psl=}
entity History {=psl
id Int @id @default(autoincrement())
character Character @relation(fields: [characterId], references: [id])
characterId Int
created_at DateTime @default(now())
command String
room_image String?
room_description String?
room_options String?
raw_response String?
error Boolean @default(false)
psl=}