fix inputnumber, Umbau auf redis-om, Neubenamung

This commit is contained in:
2024-03-11 18:27:43 +01:00
parent 6ad40b6dca
commit be146fdc6a
25 changed files with 1830 additions and 224 deletions

View File

@@ -4,13 +4,12 @@ import { Entity, Repository, Schema } from 'redis-om';
import { User } from '../models/main.model.js';
import { REDIS_CLIENT } from '../redis/redis.module.js';
import { UserEntity } from '../models/server.model.js';
// export const redis = createClient({ url: 'redis://localhost:6379' })
@Injectable()
export class UserService {
userRepository:Repository;
userSchema = new Schema('user',{
// id: string;
id: { type: 'string' },
firstname: { type: 'string' },
lastname: { type: 'string' },
email: { type: 'string' },
@@ -25,22 +24,14 @@ export class UserService {
}, {
dataStructure: 'JSON'
})
constructor(@Inject(REDIS_CLIENT) private readonly client: any){
// const redis = createClient({ url: 'redis://localhost:6379' })
this.userRepository = new Repository(this.userSchema, client)
constructor(@Inject(REDIS_CLIENT) private readonly redis: any){
this.userRepository = new Repository(this.userSchema, redis)
}
async getUserById( id:string){
return await this.userRepository.fetch(id);
}
async saveUser(user:any):Promise<UserEntity>{
return await this.userRepository.save(user.id,user) as UserEntity
}
// createUser(){
// }
// updateById(id:string){
// }
}