From 25ee295394483bb70454137f5fa3f606248e38d6 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Thu, 3 Jul 2025 14:35:24 +0200 Subject: [PATCH] update service to matchg apis --- .../lib/mih_services/mih_user_services.dart | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Frontend/lib/mih_services/mih_user_services.dart b/Frontend/lib/mih_services/mih_user_services.dart index 1432da4d..4c8f9551 100644 --- a/Frontend/lib/mih_services/mih_user_services.dart +++ b/Frontend/lib/mih_services/mih_user_services.dart @@ -83,6 +83,46 @@ class MihUserServices { } } + Future updateUserV2( + AppUser signedInUser, + String firstName, + String lastName, + String username, + String profilePicture, + String purpose, + bool isBusinessUser, + BuildContext context, + ) async { + var fileName = profilePicture.replaceAll(RegExp(r' '), '-'); + var filePath = "${signedInUser.app_id}/profile_files/$fileName"; + String profileType; + if (isBusinessUser) { + profileType = "business"; + } else { + profileType = "personal"; + } + var response = await http.put( + Uri.parse("${AppEnviroment.baseApiUrl}/user/update/v2/"), + headers: { + "Content-Type": "application/json; charset=UTF-8" + }, + body: jsonEncode({ + "idusers": signedInUser.idUser, + "username": username, + "fnam": firstName, + "lname": lastName, + "type": profileType, + "pro_pic_path": filePath, + "purpose": purpose, + }), + ); + if (response.statusCode == 200) { + return response.statusCode; + } else { + return response.statusCode; + } + } + Future updateUser( AppUser signedInUser, String firstName,