Skip to content

Instantly share code, notes, and snippets.

@daffl
Last active January 16, 2022 19:32
Show Gist options
  • Select an option

  • Save daffl/7728140456ffdfa96ec858616a99a9c2 to your computer and use it in GitHub Desktop.

Select an option

Save daffl/7728140456ffdfa96ec858616a99a9c2 to your computer and use it in GitHub Desktop.

Revisions

  1. daffl revised this gist Jan 14, 2022. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions schema.ts
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    import { HookContext } from './definitions';
    import { schema, Infer } from '@feathersjs/schema';
    import { schema, Infer } from '@feathersjs/schema'

    export const userSchema = schema({
    $id: 'User',
    @@ -11,6 +10,12 @@ export const userSchema = schema({
    email: { type: 'string' },
    password: { type: 'string' }
    }
    } as const);
    } as const)

    export type User = Infer<typeof userSchema>;
    export type User = Infer<typeof userSchema>

    // type User = {
    // id?: number;
    // email: string;
    // password: string;
    // }
  2. daffl created this gist Jan 14, 2022.
    16 changes: 16 additions & 0 deletions schema.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    import { HookContext } from './definitions';
    import { schema, Infer } from '@feathersjs/schema';

    export const userSchema = schema({
    $id: 'User',
    type: 'object',
    additionalProperties: false,
    required: ['email', 'password'],
    properties: {
    id: { type: 'number' },
    email: { type: 'string' },
    password: { type: 'string' }
    }
    } as const);

    export type User = Infer<typeof userSchema>;