File tree Expand file tree Collapse file tree 5 files changed +47
-6
lines changed
@green-stack-core/scripts Expand file tree Collapse file tree 5 files changed +47
-6
lines changed Original file line number Diff line number Diff line change 1+ import { validateDriverModel } from '@db/driver'
2+ import { User } from '../schemas/User.schema'
3+ import { createSchemaModel } from '@db/driver'
4+
5+ /* --- Model ----------------------------------------------------------------------------------- */
6+
7+ export const Users = createSchemaModel(User)
8+
9+ /* --- Drivers --------------------------------------------------------------------------------- */
10+
11+ export const driverModel = validateDriverModel(Users.driver)
Original file line number Diff line number Diff line change 1+ import { z, schema } from '@green-stack/schemas'
2+ import { partials } from '@app/registries/schemas.partials'
3+
4+ /* --- Description ----------------------------------------------------------------------------- */
5+
6+ const d = "Essential user info"
7+
8+ /** --- User ----------------------------------------------------------------------------------- */
9+ /** -i- Essential user info */
10+ export const User = schema('User', {
11+
12+ userId: z
13+ .string()
14+ .index()
15+ .unique()
16+ .describe('Auth provider sub or user ID'),
17+ email: z
18+ .string()
19+ .unique()
20+ .describe('Primary Github email used during OAuth'),
21+
22+ // -i- Partial fields from other modules / features / packages / plugins
23+
24+ ...partials.User,
25+
26+ }).describe(d)
27+
28+ /* --- Type Alias ------------------------------------------------------------------------------ */
29+
30+ export type User = z.input<typeof User>
Original file line number Diff line number Diff line change @@ -46,12 +46,11 @@ const collectSchemas = () => {
4646 if (isEmpty(allPartialSchemaPaths)) {
4747 fs.writeFileSync('../../packages/@registries/schemas.partials.ts', [
4848
49- genMsg,
50- `import { z } from '@green-stack/schemas'`,
49+ `${genMsg}import { z } from '@green-stack/schemas'`,
5150
52- createDivider('Exports'),
51+ `${ createDivider('Exports')}\n` ,
5352
54- `export const partials = {} as Record<string, z.ZodRawShape>`,
53+ `export const partials = {} as Record<string, z.ZodRawShape>\n `,
5554
5655 ].join('\n'))
5756 return
Original file line number Diff line number Diff line change 11// -i- Auto generated with "npx turbo run @green-stack/core#collect:schemas"
2+ export { User } from '@app/core/schemas/User.schema'
23export { HealthCheckOutput } from '@app/core/schemas/HealthCheckOutput'
34export { HealthCheckInput } from '@app/core/schemas/HealthCheckInput'
Original file line number Diff line number Diff line change 11// -i- Auto generated with "npx turbo run @green-stack/core#collect:schemas"
2-
32import { z } from '@green-stack/schemas'
43/* --- Exports --------------------------------------------------------------------------------- */
5- export const partials = {} as Record<string, z.ZodRawShape>
4+
5+ export const partials = {} as Record<string, z.ZodRawShape>
You can’t perform that action at this time.
0 commit comments