Skip to content

Instantly share code, notes, and snippets.

@iMichaelOwolabi
Created September 30, 2022 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iMichaelOwolabi/c7dbc25e6706236e00c958edf0699068 to your computer and use it in GitHub Desktop.
Save iMichaelOwolabi/c7dbc25e6706236e00c958edf0699068 to your computer and use it in GitHub Desktop.
User repo sample code for the passwordless auth
import { Entity, Schema } from 'redis-om';
import { redisClient } from '../db/index.js';
class UserRepository extends Entity {}
const userSchema = new Schema(UserRepository, {
firstName: { type: 'string' },
lastName: { type: 'string' },
email: { type: 'string' },
userName: { type: 'string' },
createdAt: { type: 'date', sortable: true },
updatedAt: { type: 'date', sortable: true },
});
const userRepository = redisClient.fetchRepository(userSchema);
await userRepository.createIndex();
export { userRepository };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment