Skip to content

Instantly share code, notes, and snippets.

@iMichaelOwolabi
Created September 30, 2022 17:30
Embed
What would you like to do?
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