User repo sample code for the passwordless auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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