Image Upload, spinner aktivirt, listings & details überarbeitet
This commit is contained in:
@@ -20,9 +20,9 @@ export class UserController {
|
||||
return this.userService.saveUser(user);
|
||||
}
|
||||
|
||||
// @Put()
|
||||
// update(@Body() user: any):Promise<UserEntity>{
|
||||
// this.logger.info(`update User`);
|
||||
// return this.userService.saveUser(user);
|
||||
// }
|
||||
@Post('search')
|
||||
find(@Body() criteria: any): any {
|
||||
return this.userService.findUser(criteria);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@ import { Module } from '@nestjs/common';
|
||||
import { UserController } from './user.controller.js';
|
||||
import { UserService } from './user.service.js';
|
||||
import { RedisModule } from '../redis/redis.module.js';
|
||||
import { FileService } from '../file/file.service.js';
|
||||
|
||||
@Module({
|
||||
imports: [RedisModule],
|
||||
controllers: [UserController],
|
||||
providers: [UserService]
|
||||
providers: [UserService,FileService]
|
||||
})
|
||||
export class UserModule {
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Entity, Repository, Schema } from 'redis-om';
|
||||
import { ListingCriteria, User } from '../models/main.model.js';
|
||||
import { REDIS_CLIENT } from '../redis/redis.module.js';
|
||||
import { UserEntity } from '../models/server.model.js';
|
||||
import { FileService } from '../file/file.service.js';
|
||||
|
||||
@Injectable()
|
||||
export class UserService {
|
||||
@@ -24,12 +25,15 @@ export class UserService {
|
||||
}, {
|
||||
dataStructure: 'JSON'
|
||||
})
|
||||
constructor(@Inject(REDIS_CLIENT) private readonly redis: any){
|
||||
constructor(@Inject(REDIS_CLIENT) private readonly redis: any,private fileService:FileService){
|
||||
this.userRepository = new Repository(this.userSchema, redis)
|
||||
this.userRepository.createIndex();
|
||||
}
|
||||
async getUserById( id:string){
|
||||
return await this.userRepository.fetch(id);
|
||||
const user = await this.userRepository.fetch(id) as UserEntity;
|
||||
user.hasCompanyLogo=this.fileService.hasCompanyLogo(id);
|
||||
user.hasProfile=this.fileService.hasProfile(id);
|
||||
return user;
|
||||
}
|
||||
async saveUser(user:any):Promise<UserEntity>{
|
||||
return await this.userRepository.save(user.id,user) as UserEntity
|
||||
|
||||
Reference in New Issue
Block a user