File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
src/pages/gen2/build-a-backend/data/connect-to-existing-database Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -128,22 +128,26 @@ import { schema as rdsSchema } from './schema.rds.ts'
128
128
129
129
// Rename models or fields to be more idiomatic for frontend code
130
130
// highlight-start
131
- rdsSchema .models .todos .renameTo (" Todo" )
132
- rdsSchema .models .todos .fields .title .renameTo (" content" )
133
- // highlight-end
131
+ const modifiedRds = rdsSchema .renameModels (() => [
132
+ [' todo' , ' Todo' ]
133
+ ]).renameModelFields ((models ) => [
134
+ models .Todo .renameFields (() => [
135
+ [' title' , ' content' ],
136
+ ]),
137
+ ])
134
138
135
139
const schema = a .schema ({
136
- Todo: a .model ({
137
- content: a .string ()
138
- isDone : a .boolean ()
139
- })
140
- }).authorization ([a .allow .public ()])
140
+ Post: a .model ({
141
+ title: a .string ()
142
+ }).authorization ([a .allow .public ()])
143
+ })
141
144
142
145
const combinedSchema = a .schema .combine ([
143
146
schema ,
144
- rdsSchema
147
+ modifiedRds
145
148
])
146
149
150
+
147
151
export type Schema = typeof schema
148
152
export const data = defineData ({
149
153
schema: combinedSchema
You can’t perform that action at this time.
0 commit comments