fix: add missing await

This commit is contained in:
yassinedorbozgithub 2024-12-07 11:59:00 +01:00
parent 62e59069dd
commit afa8364996
12 changed files with 17 additions and 17 deletions

View File

@ -153,7 +153,7 @@ export class AttachmentController extends BaseController<Attachment> {
throw new NotFoundException('Attachment not found');
}
return this.attachmentService.download(attachment);
return await this.attachmentService.download(attachment);
}
/**

View File

@ -164,8 +164,8 @@ export class MenuController extends BaseController<
@CsrfCheck(true)
@Patch(':id')
async updateOne(@Body() body: MenuCreateDto, @Param('id') id: string) {
if (!id) return this.create(body);
return this.menuService.updateOne(id, body);
if (!id) return await this.create(body);
return await this.menuService.updateOne(id, body);
}
/**

View File

@ -100,7 +100,7 @@ export class ContentRepository extends BaseRepository<
* @returns A promise that resolves to the matching content documents.
*/
async textSearch(query: string) {
return this.find({
return await this.find({
$text: {
$search: query,
$diacriticSensitive: false,

View File

@ -49,7 +49,7 @@ export class ContentService extends BaseService<
* @return A list of content matching the search query.
*/
async textSearch(query: string) {
return this.repository.textSearch(query);
return await this.repository.textSearch(query);
}
/**

View File

@ -272,7 +272,7 @@ export default class CoreNluHelper extends BaseNlpHelper<
},
);
return this.filterEntitiesByConfidence(nlp, threshold);
return await this.filterEntitiesByConfidence(nlp, threshold);
} catch (err) {
this.logger.error('Core NLU Helper : Unable to parse nlp', err);
throw err;

View File

@ -137,7 +137,7 @@ export class TranslationController extends BaseController<Translation> {
);
await Promise.all(queue);
// Purge non existing translations
return this.translationService.deleteMany({
return await this.translationService.deleteMany({
str: { $nin: strings },
});
}

View File

@ -74,6 +74,6 @@ export class NlpSampleEntityService extends BaseService<
} as NlpSampleEntity;
});
return this.createMany(sampleEntities);
return await this.createMany(sampleEntities);
}
}

View File

@ -84,7 +84,7 @@ export class ReadOnlyUserController extends BaseController<
@Roles('public')
@Get('bot/profile_pic')
async botProfilePic(@Query('color') color: string) {
return getBotAvatar(color);
return await getBotAvatar(color);
}
/**
@ -103,7 +103,7 @@ export class ReadOnlyUserController extends BaseController<
} catch (e) {
const user = await this.userService.findOne(id);
if (user) {
return generateInitialsAvatar(user);
return await generateInitialsAvatar(user);
} else {
throw new NotFoundException(`user with ID ${id} not found`);
}

View File

@ -127,7 +127,7 @@ export class PasswordResetService {
* @returns The signed JWT token.
*/
async sign(dto: UserRequestResetDto) {
return this.jwtService.signAsync(dto, this.jwtSignOptions);
return await this.jwtService.signAsync(dto, this.jwtSignOptions);
}
/**
@ -138,6 +138,6 @@ export class PasswordResetService {
* @returns The decoded payload of the token.
*/
async verify(token: string): Promise<UserRequestResetDto> {
return this.jwtService.verifyAsync(token, this.jwtSignOptions);
return await this.jwtService.verifyAsync(token, this.jwtSignOptions);
}
}

View File

@ -50,7 +50,7 @@ export class ValidateAccountService {
* @returns A promise that resolves to the signed JWT token.
*/
async sign(dto: { email: string }) {
return this.jwtService.signAsync(dto, this.jwtSignOptions);
return await this.jwtService.signAsync(dto, this.jwtSignOptions);
}
/**
@ -61,7 +61,7 @@ export class ValidateAccountService {
* @returns A promise that resolves to an object containing the user's email.
*/
async verify(token: string): Promise<{ email: string }> {
return this.jwtService.verifyAsync(token, this.jwtSignOptions);
return await this.jwtService.verifyAsync(token, this.jwtSignOptions);
}
/**

View File

@ -149,7 +149,7 @@ export class SocketIoClient {
url: string,
options?: Partial<Omit<IOOutgoingMessage, "url" | "method" | "data">>,
): Promise<IOIncomingMessage<T>> {
return this.request({
return await this.request({
method: "get",
url,
...options,

View File

@ -167,7 +167,7 @@ export class SocketIoClient {
url: string,
options?: Partial<Omit<IOOutgoingMessage, "url" | "method" | "body">>,
): Promise<IOIncomingMessage<T>> {
return this.request({
return await this.request({
method: "get",
url,
...options,
@ -178,7 +178,7 @@ export class SocketIoClient {
url: string,
options: Partial<Omit<IOOutgoingMessage, "url" | "method">>,
): Promise<IOIncomingMessage<T>> {
return this.request({
return await this.request({
method: "post",
url,
...options,