mirror of
https://github.com/sergeyyarkov/educt-server.git
synced 2026-10-11 10:19:20 +03:00
fix: error while updating user info
This commit is contained in:
parent
28fe68aa26
commit
046e3a28f3
@ -8,11 +8,13 @@
|
||||
|
||||
## Added
|
||||
|
||||
- Chat between users. (chat history).
|
||||
- About description for user and `last_login` column date
|
||||
- Updating info api route of authorized user
|
||||
|
||||
### Fix
|
||||
|
||||
- Fixed updating user info
|
||||
- Cleaning up session store before starting websocket server
|
||||
|
||||
## [1.1.0] - 2022-01-31
|
||||
|
||||
@ -314,6 +314,7 @@ export default class MeService {
|
||||
auth: AuthContract
|
||||
): Promise<IResponse> {
|
||||
const user = await auth.use(this.authGuard).authenticate();
|
||||
const { about, ...newContacts } = data;
|
||||
|
||||
if (Object.keys(data).length === 0) {
|
||||
return {
|
||||
@ -330,7 +331,7 @@ export default class MeService {
|
||||
/**
|
||||
* Personal info updating
|
||||
*/
|
||||
if (data.about !== undefined) {
|
||||
if (about !== undefined) {
|
||||
await this.userRepository.updateInfo(user.id, data);
|
||||
}
|
||||
|
||||
@ -338,15 +339,10 @@ export default class MeService {
|
||||
* Contacts updating
|
||||
*/
|
||||
if (data.phone_number !== undefined || data.twitter_id !== undefined || data.telegram_id !== undefined) {
|
||||
const contacts = await this.contactRepository.update(user, {
|
||||
phone_number: data.phone_number,
|
||||
twitter_id: data.twitter_id,
|
||||
telegram_id: data.telegram_id,
|
||||
vk_id: data.vk_id,
|
||||
});
|
||||
const contacts = await this.contactRepository.update(user, newContacts);
|
||||
|
||||
if (!contacts) {
|
||||
await this.contactRepository.create(user, data);
|
||||
await this.contactRepository.create(user, newContacts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
import Env from '@ioc:Adonis/Core/Env';
|
||||
import { CloudinaryConfig } from '@ioc:Adonis/Addons/Cloudinary';
|
||||
|
||||
const cloudinaryConfig: CloudinaryConfig = {
|
||||
cloudName: Env.get('CLOUDINARY_CLOUD_NAME'),
|
||||
apiKey: Env.get('CLOUDINARY_API_KEY'),
|
||||
apiSecret: Env.get('CLOUDINARY_API_SECRET'),
|
||||
secure: Env.get('CLOUDINARY_SECURE', true),
|
||||
};
|
||||
|
||||
export default cloudinaryConfig;
|
||||
Loading…
x
Reference in New Issue
Block a user