Created
September 30, 2022 17:30
-
-
Save iMichaelOwolabi/c7dbc25e6706236e00c958edf0699068 to your computer and use it in GitHub Desktop.
User repo sample code for the passwordless auth
This file contains hidden or 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