HOT-FIX. Коррекция ошибок

This commit is contained in:
vigdorov
2020-09-07 20:38:24 +03:00
parent 621b739dc6
commit 8352024bb5

View File

@ -140,7 +140,7 @@ export class StoreService {
const user = await this.loadUserByToken(access_token); const user = await this.loadUserByToken(access_token);
if (!user.is_admin && user.login !== searchStore.author) { if (!user.is_admin && user.login !== searchStore.author) {
throw new UnauthorizedException('Доступ запрещен'); throw new NotFoundException(`Not found api key "${omitProps.key}"`);
} }
const store = { const store = {
@ -182,7 +182,7 @@ export class StoreService {
if (user.is_admin || user.login === store.author || !store.hide) { if (user.is_admin || user.login === store.author || !store.hide) {
return store; return store;
} }
throw new UnauthorizedException('Доступ запрещен'); throw new NotFoundException(`Not found api key "${key}"`);
} }
async removeOne(api: string, key: string, access_token: string): Promise<Store> { async removeOne(api: string, key: string, access_token: string): Promise<Store> {
@ -192,7 +192,7 @@ export class StoreService {
const user = await this.loadUserByToken(access_token); const user = await this.loadUserByToken(access_token);
if (!user.is_admin && user.login !== searchStore.author) { if (!user.is_admin && user.login !== searchStore.author) {
throw new UnauthorizedException('Доступ запрещен'); throw new NotFoundException(`Not found api key "${key}"`);
} }
await this.storeModel(api).deleteOne({key}); await this.storeModel(api).deleteOne({key});