feat(verify): phone

This commit is contained in:
mso7nueh
2025-05-21 17:42:43 +03:00
parent cb9fff9327
commit 067e0929ed
98 changed files with 821 additions and 760 deletions

View File

@@ -5,7 +5,7 @@ part 'badge_model.freezed.dart';
part 'badge_model.g.dart';
@freezed
class BadgeModel with _$BadgeModel {
abstract class BadgeModel with _$BadgeModel {
const factory BadgeModel({
required int id,
required String title,

View File

@@ -5,7 +5,7 @@ part 'chosen_diets_pagination_model.freezed.dart';
part 'chosen_diets_pagination_model.g.dart';
@freezed
class ChosenDietsPaginationModel with _$ChosenDietsPaginationModel {
abstract class ChosenDietsPaginationModel with _$ChosenDietsPaginationModel {
factory ChosenDietsPaginationModel({
@JsonKey(name: 'data') required List<ChosenDietModel> diets,
}) = _ChosenDietsPaginationModel;
@@ -14,7 +14,7 @@ class ChosenDietsPaginationModel with _$ChosenDietsPaginationModel {
}
@freezed
class ChosenDietModel with _$ChosenDietModel {
abstract class ChosenDietModel with _$ChosenDietModel {
factory ChosenDietModel({
@JsonKey(name: 'id') required int chosenDietID,
@JsonKey(name: 'chosen_plan_id') required int chosenPlanId,

View File

@@ -5,7 +5,7 @@ part 'circumference_model.freezed.dart';
part 'circumference_model.g.dart';
@freezed
class CircumferenceModel with _$CircumferenceModel {
abstract class CircumferenceModel with _$CircumferenceModel {
const factory CircumferenceModel({
@JsonKey(name: "id") required int id,
@JsonKey(name: "user_id") required int userId,

View File

@@ -6,7 +6,7 @@ part 'profile_model.freezed.dart';
part 'profile_model.g.dart';
@freezed
class ProfileModel with _$ProfileModel {
abstract class ProfileModel with _$ProfileModel {
const factory ProfileModel({
@JsonKey(name: "id") required int id,
@JsonKey(name: "name") required String name,
@@ -31,7 +31,7 @@ class ProfileModel with _$ProfileModel {
}
@freezed
class DiplomasAndCertificatesModel with _$DiplomasAndCertificatesModel {
abstract class DiplomasAndCertificatesModel with _$DiplomasAndCertificatesModel {
const factory DiplomasAndCertificatesModel({
required int id,
required String path,
@@ -41,10 +41,10 @@ class DiplomasAndCertificatesModel with _$DiplomasAndCertificatesModel {
}
@freezed
class EducationModel with _$EducationModel {
abstract class EducationModel with _$EducationModel {
const factory EducationModel({
@JsonKey(name: "has_medical_education") int? hasMedicalEducation,
@JsonKey(name: "completed_cources") List<Map<String, CompletedCoursesModel>>? completedCourses,
@JsonKey(name: "completed_courses") List<Map<String, CompletedCoursesModel>>? completedCourses,
@JsonKey(name: "vk_link") String? vkLink,
@JsonKey(name: "insta_link") String? instaLink,
@JsonKey(name: "fb_link") String? fbLink,
@@ -57,7 +57,7 @@ class EducationModel with _$EducationModel {
}
@freezed
class CompletedCoursesModel with _$CompletedCoursesModel {
abstract class CompletedCoursesModel with _$CompletedCoursesModel {
const factory CompletedCoursesModel({
required String date,
required String title,
@@ -67,7 +67,7 @@ class CompletedCoursesModel with _$CompletedCoursesModel {
}
@freezed
class ProfileDetailsModel with _$ProfileDetailsModel {
abstract class ProfileDetailsModel with _$ProfileDetailsModel {
const factory ProfileDetailsModel({
@JsonKey(name: "first_name") required String firstName,
@JsonKey(name: "last_name") required String lastName,
@@ -102,7 +102,7 @@ class ProfileDetailsModel with _$ProfileDetailsModel {
}
@freezed
class ProfilePreviewModel with _$ProfilePreviewModel {
abstract class ProfilePreviewModel with _$ProfilePreviewModel {
const factory ProfilePreviewModel({
@JsonKey(name: "profile_photo_url") required String profilePhotoUrl,
}) = _ProfilePreviewModel;

View File

@@ -6,7 +6,7 @@ part 'sub_model.freezed.dart';
part 'sub_model.g.dart';
@freezed
class SubPaginationModel with _$SubPaginationModel {
abstract class SubPaginationModel with _$SubPaginationModel {
const factory SubPaginationModel({
required List<SubModel> data,
required Links links,
@@ -17,7 +17,7 @@ class SubPaginationModel with _$SubPaginationModel {
}
@freezed
class SubModel with _$SubModel {
abstract class SubModel with _$SubModel {
const factory SubModel({
required String slug,
required String name,

View File

@@ -5,7 +5,7 @@ part 'weight_model.freezed.dart';
part 'weight_model.g.dart';
@freezed
class WeightModel with _$WeightModel {
abstract class WeightModel with _$WeightModel {
const factory WeightModel({
@JsonKey(name: "id") required int id,
@JsonKey(name: "user_id") required int userId,

View File

@@ -36,6 +36,10 @@ class ProfileCubit extends Cubit<ProfileState> {
}
}
Future<String> getPassKey(String phone) async {
return (await profileRepository.getPassKey('+79150626151'));
}
Future<void> getMyProfile({
String period = '1',
}) async {

View File

@@ -221,6 +221,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ElevatedButton(onPressed: () async {
final String passKey = await profileCubit.getPassKey('+79150626151');
GoRouter.of(context).pushNamed('verifyScreen', extra: passKey);
}, child: Text('phone verify')),
_header(state),
if (state.profile.roles.contains('consultant'))
Column(

View File

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:io';
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
@@ -180,4 +181,8 @@ class ProfileRepository {
rethrow;
}
}
Future<String> getPassKey(String phone) async {
return (jsonDecode((await profileService.getPassKey(json: '{"route_name": "user_detailz.change-phone-verify", "route_params": {"phone": "$phone"}}'))))['key_is']!;
}
}

View File

@@ -103,4 +103,9 @@ abstract class ProfileService {
@GET('/api/profile/chosen_diets')
Future<ChosenDietsPaginationModel> getChosenDiets();
@POST('/api/profile/make_pass_key')
Future<String> getPassKey({
@Body() required String json,
});
}