### Installation Rules for Application Bundle (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/CMakeLists.txt Defines the installation rules for creating a relocatable application bundle. It cleans the build bundle directory, installs the executable, and copies necessary data, libraries, and assets. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Installation Rules for Runtime Components (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Configures the installation process for the Glowzel application. It sets up the installation directory, installs the main executable, and copies necessary support files like ICU data, Flutter library, and plugin libraries. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Project Setup and Configuration (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Initializes the CMake project, sets the project name and languages, and defines the executable name. It also enforces modern CMake behaviors and configures build types based on generator capabilities. ```cmake cmake_minimum_required(VERSION 3.14) project(glowzel LANGUAGES CXX) set(BINARY_NAME "glowzel")cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### AOT Library Installation (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library for the application, but only for 'Profile' and 'Release' build configurations. This optimizes runtime performance for non-debug builds. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Native Assets and Flutter Assets Installation (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Installs native assets and Flutter assets required by the application. It ensures that native assets are copied to the correct location and that Flutter assets are fully re-copied on each build to prevent stale files. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### User Authentication and Profile Management (Dart) Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Handles user registration, login, and profile setup. It uses JWT for authentication and securely stores tokens. Dependencies include models for input data and an AuthRepository for API interactions. ```dart import 'package:Glowzel/module/authentication/model/login_input.dart'; import 'package:Glowzel/module/authentication/model/signup_input.dart'; import 'package:Glowzel/module/authentication/model/profile_input.dart'; import 'package:Glowzel/module/authentication/repository/auth_repository.dart'; // Login with email and password final loginInput = LoginInput( email: 'user@example.com', password: 'securePassword123', ); // AuthRepository handles the API call final authResponse = await authRepository.login(loginInput); // Response: AuthResponse(id: "123", firstname: "John", lastname: "Doe", // email: "user@example.com", token: "eyJhbG...", isFirstLogin: false) // Token is automatically stored and set on DioClient await sessionRepository.setToken(authResponse.token); dioClient.setToken(authResponse.token); // Signup with profile information final signupInput = SignupInput( firstName: 'John', lastName: 'Doe', email: 'newuser@example.com', password: 'securePassword123', profile: ProfileInput( dob: '1990-01-15', gender: 'male', skinType: 'combination', skinSensitivity: 'moderate', skinRoutine: 'basic', ), ); final email = await authRepository.signup(signupInput, context); // Returns email for OTP verification ``` -------------------------------- ### Dependency and Subdirectory Management (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/CMakeLists.txt Manages Flutter integration and system dependencies. It finds PkgConfig and GTK, adds the Flutter managed directory, includes generated plugin configurations, and adds the runner subdirectory. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_subdirectory("runner") add_dependencies(${BINARY_NAME} flutter_assemble) include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Project Configuration and Build Settings (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/CMakeLists.txt Configures the CMake project, sets the binary name and application ID, and defines build policies. It also handles cross-compilation by setting sysroot paths if a target platform is specified. ```cmake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) set(BINARY_NAME "glowzel") set(APPLICATION_ID "com.example.glowzel") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ``` -------------------------------- ### Executable Output Directory Configuration (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/CMakeLists.txt Configures the output directory for the main executable. It sets the RUNTIME_OUTPUT_DIRECTORY to a subdirectory to prevent users from running unbundled copies of the application. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Build Configuration Options (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Defines the available build configurations (Debug, Profile, Release) and sets the default build type if not already specified. This is crucial for managing different build variants of the application. ```cmake get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() ``` -------------------------------- ### Generated Plugin Build Rules (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Includes the `generated_plugins.cmake` file, which manages the build rules for plugins and adds them to the application. This is essential for integrating third-party or custom plugins. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Standard Compilation Settings Function (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Defines a reusable function `APPLY_STANDARD_SETTINGS` to apply common compilation features, options, and definitions to CMake targets. This promotes consistency across different parts of the build. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() ``` -------------------------------- ### Define Executable Target with Source Files (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/runner/CMakeLists.txt This snippet defines the main executable target for the application using CMake. It lists the primary source files, including generated plugin registration files, that will be compiled into the executable. Ensure that any new source files are added to this list for them to be included in the build. ```cmake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) # Add preprocessor definitions for the application ID. add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") # Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Profile Build Mode Settings (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Configures linker and compiler flags specifically for the 'Profile' build mode, often by inheriting settings from the 'Release' mode. This ensures consistent performance characteristics for profiling. ```cmake set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### CMake: Define Helper Function for List Prepending Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/flutter/CMakeLists.txt Defines a CMake function `list_prepend` that adds a prefix to each element of a given list. This is a workaround for older CMake versions (pre-3.10) that lack the `list(TRANSFORM ... PREPEND ...)` command. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### Flutter and Runner Integration (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/CMakeLists.txt Includes the Flutter managed directory and the application's runner subdirectory using `add_subdirectory`. This integrates Flutter's build system and the application's specific build logic. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) add_subdirectory("runner") ``` -------------------------------- ### Authentication API Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Handles user registration, login, and profile management. Uses JWT bearer tokens for secure session management. ```APIDOC ## Authentication API ### Description Handles user registration, login, and profile management. Uses JWT bearer tokens for secure session management. ### Method POST ### Endpoint /api/login ### Parameters #### Request Body - **email** (string) - Required - User's email address - **password** (string) - Required - User's password ### Request Example ```json { "email": "user@example.com", "password": "securePassword123" } ``` ### Response #### Success Response (200) - **id** (string) - User ID - **firstname** (string) - User's first name - **lastname** (string) - User's last name - **email** (string) - User's email address - **token** (string) - JWT bearer token for authentication - **isFirstLogin** (boolean) - Indicates if this is the user's first login #### Response Example ```json { "id": "123", "firstname": "John", "lastname": "Doe", "email": "user@example.com", "token": "eyJhbG...", "isFirstLogin": false } ``` ## Signup API ### Description Registers a new user with their basic information and initial profile details. ### Method POST ### Endpoint /api/signup ### Parameters #### Request Body - **firstName** (string) - Required - User's first name - **lastName** (string) - Required - User's last name - **email** (string) - Required - User's email address - **password** (string) - Required - User's password - **profile** (object) - Required - User's profile information - **dob** (string) - Required - Date of birth (YYYY-MM-DD) - **gender** (string) - Required - User's gender - **skinType** (string) - Required - User's skin type - **skinSensitivity** (string) - Required - User's skin sensitivity level - **skinRoutine** (string) - Required - User's current skincare routine ### Request Example ```json { "firstName": "John", "lastName": "Doe", "email": "newuser@example.com", "password": "securePassword123", "profile": { "dob": "1990-01-15", "gender": "male", "skinType": "combination", "skinSensitivity": "moderate", "skinRoutine": "basic" } } ``` ### Response #### Success Response (200) - **email** (string) - The email address of the newly registered user, used for OTP verification. #### Response Example ```json { "email": "newuser@example.com" } ``` ``` -------------------------------- ### Apply Standard Build Settings in CMake Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/runner/CMakeLists.txt This snippet applies a set of standard build settings to the executable target. This simplifies the build process by using pre-defined settings. This can be removed if custom build settings are needed. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Standard Compilation Settings Function (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/CMakeLists.txt Defines a CMake function to apply standard compilation settings to targets. This includes setting C++ standard, enabling warnings, optimizing for non-debug builds, and defining NDEBUG for release builds. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "<$>:-O3>") target_compile_definitions(${TARGET} PRIVATE "<$>:NDEBUG>") endfunction() ``` -------------------------------- ### Create Daily Skin Log Entry (Dart) Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Allows users to log daily skin condition, sleep, diet, and water intake for monitoring. Requires skin feel, description, sleep hours, diet items, and water intake. The API endpoint is POST /api/daily-skin-log. It returns a confirmation of the log creation. ```dart import 'package:Glowzel/module/diary/model/daily_log_input.dart'; // Create a daily skin log entry final dailyLogInput = DailySkinLogInput( skinFeel: 'smooth', // e.g., 'smooth', 'dry', 'oily', 'irritated' skinDescription: 'Skin feels hydrated today with slight redness on cheeks', sleepHours: '7.5', // hours of sleep dietItems: 'fruits, vegetables, water', // diet description waterIntake: '8', // glasses of water ); // Submit the daily log final dailyLogResponse = await authRepository.createDailySkinLog(dailyLogInput); // POST /api/daily-skin-log // Body: {"skin_feel": "smooth", "skin_description": "...", // "sleep_hours": "7.5", "diet_items": "...", "water_intake": "8"} // Get a specific daily log by ID final logDetails = await authRepository.getDailySkinLog(456); // GET /api/daily-skin-log/456 // Update an existing daily log final updatedLog = await authRepository.updateDailySkinLog( logId: 456, input: { 'skin_feel': 'dry', 'water_intake': '10', }, ); // PUT /api/daily-skin-log/456 // Fetch user's daily log history final logHistory = await authRepository.fetchDailyLogHistory(); // GET /api/daily-skin-log/user/{userId}/history?limit=50&skip=0 // Returns: List> with log_date and all log details ``` -------------------------------- ### Session Management API Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt APIs for managing user session data, including tokens, user IDs, and other local storage items. ```APIDOC ## Session Management Endpoints ### Description This section details the endpoints related to managing user session data locally. ### Method Various (GET, POST, DELETE, PUT) ### Endpoints - **Check Login Status**: No direct API endpoint, managed client-side. - **Set Token**: No direct API endpoint, managed client-side. - **Get Token**: No direct API endpoint, managed client-side. - **Remove Token**: No direct API endpoint, managed client-side. - **Set ID**: No direct API endpoint, managed client-side. - **Get ID**: No direct API endpoint, managed client-side. - **Set Scan ID**: No direct API endpoint, managed client-side. - **Get Scan ID**: No direct API endpoint, managed client-side. - **Set Log ID**: No direct API endpoint, managed client-side. - **Get Log ID**: No direct API endpoint, managed client-side. - **Set Morning Toggle for Date**: No direct API endpoint, managed client-side. - **Get Morning Toggle for Date**: No direct API endpoint, managed client-side. - **Set Evening Toggle for Date**: No direct API endpoint, managed client-side. - **Get Evening Toggle for Date**: No direct API endpoint, managed client-side. - **Clear Local Storage**: No direct API endpoint, managed client-side. ### Parameters Parameters are managed client-side and not exposed as API request bodies for these operations. ### Response Responses are typically boolean (for status checks) or string/list of booleans (for retrieved data), managed client-side. ``` -------------------------------- ### User Profile Management API Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt APIs for managing user profile information, including basic details, skin profile, password changes, and account deletion. ```APIDOC ## Update Basic Profile ### Description Updates the user's first name, last name, and profile image. ### Method PUT ### Endpoint /api/me ### Parameters #### Request Body - **first_name** (string) - Required - The user's first name. - **last_name** (string) - Required - The user's last name. - **image** (string) - Optional - Base64 encoded profile image. ### Request Example ```json { "first_name": "John", "last_name": "Smith", "image": "" } ``` ### Response #### Success Response (200) - **id** (string) - User ID. - **firstname** (string) - User's first name. - **lastname** (string) - User's last name. - **email** (string) - User's email. - **image** (string) - URL to the user's profile image. - **profile** (object) - User's profile details. ## Update Skin Profile ### Description Updates the user's skin profile information, including skin type, sensitivity, concerns, and goals. ### Method PUT ### Endpoint /api/profile ### Parameters #### Request Body - **skinType** (string) - Required - The user's skin type (e.g., 'oily', 'dry', 'combination'). - **skinSensitivity** (string) - Required - The user's skin sensitivity level (e.g., 'high', 'medium', 'low'). - **skinConcern** (array of strings) - Optional - List of skin concerns (e.g., ['acne', 'dark_spots']). - **skinGoals** (string) - Optional - The user's skin goals (e.g., 'Clear and glowing skin'). ### Request Example ```json { "skinType": "oily", "skinSensitivity": "high", "skinConcern": ["acne", "dark_spots"], "skinGoals": "Clear and glowing skin" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. ## Get Current User Data ### Description Retrieves the current logged-in user's data. ### Method GET ### Endpoint /api/me ### Response #### Success Response (200) - **id** (string) - User ID. - **firstname** (string) - User's first name. - **lastname** (string) - User's last name. - **email** (string) - User's email. - **image** (string) - URL to the user's profile image. - **profile** (object) - User's profile details. ## Change Password ### Description Changes the user's account password. ### Method POST ### Endpoint /api/change-password ### Parameters #### Request Body - **old_password** (string) - Required - The user's current password. - **new_password** (string) - Required - The user's new password. ### Request Example ```json { "old_password": "oldPassword123", "new_password": "newPassword456" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. ## Request Account Deletion OTP ### Description Requests an OTP to initiate the account deletion process. ### Method POST ### Endpoint /api/users/deleteAccount/otp ### Parameters #### Request Body - **phone** (string) - Required - The user's phone number. ### Request Example ```json { "phone": "1234567890" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating OTP sent. ## Verify OTP and Delete Account ### Description Verifies the OTP and proceeds with account deletion. ### Method DELETE ### Endpoint /api/users/deleteAccount/verify ### Parameters #### Request Body - **phone** (string) - Required - The user's phone number. - **otp** (string) - Required - The One-Time Password received. ### Request Example ```json { "phone": "1234567890", "otp": "123456" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating account deletion. ## Logout ### Description Logs the user out of the application, clearing session and token data. ### Method POST ### Endpoint /api/logout ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating successful logout. ``` -------------------------------- ### OTP Verification API Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Handles OTP (One-Time Password) management for account activation and password reset flows. ```APIDOC ## Resend Activation OTP API ### Description Resends the activation OTP to the user's email address. ### Method POST ### Endpoint /api/resend-activation-otp ### Parameters #### Request Body - **email** (string) - Required - The user's email address. ### Request Example ```json { "email": "user@example.com" } ``` ## Verify Activation OTP API ### Description Verifies the OTP code sent for account activation or password reset. ### Method POST ### Endpoint /api/activate-otp ### Parameters #### Request Body - **email** (string) - Required - The user's email address. - **otp_code** (string) - Required - The OTP code received. - **purpose** (string) - Required - The purpose of the OTP ('activation' or 'password_reset'). ### Request Example ```json { "email": "user@example.com", "otp_code": "123456", "purpose": "activation" } ``` ### Response #### Success Response (200) - **isVerified** (boolean) - True if the OTP is valid, false otherwise. #### Response Example ```json { "isVerified": true } ``` ## Forgot Password API ### Description Initiates the password reset process by sending an OTP to the user's registered email. ### Method POST ### Endpoint /api/forgot-password ### Parameters #### Request Body - **email** (string) - Required - The user's email address. ### Request Example ```json { "email": "user@example.com" } ``` ## Reset Password with OTP API ### Description Resets the user's password after successful OTP verification. ### Method POST ### Endpoint /api/reset-password-otp ### Parameters #### Request Body - **verify_in** (object) - Required - Verification details. - **email** (string) - Required - User's email address. - **otp_code** (string) - Required - The OTP code received. - **purpose** (string) - Required - The purpose of the OTP ('activation' or 'password_reset'). - **reset_in** (object) - Required - Reset details. - **password** (string) - Required - The new password for the user. ### Request Example ```json { "verify_in": { "email": "user@example.com", "otp_code": "123456", "purpose": "password_reset" }, "reset_in": { "password": "newSecurePassword456" } } ``` ``` -------------------------------- ### CMake: Custom Command for Flutter Tool Backend Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/flutter/CMakeLists.txt Defines a custom CMake command to execute the Flutter tool backend script. This command is designed to run every time by outputting a non-existent file `_phony_` as a dependency. It sets up the environment and passes build parameters to the script. ```cmake add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) ``` -------------------------------- ### Assemble Flutter Build Artifacts (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/flutter/CMakeLists.txt This CMake code defines a custom target 'flutter_assemble' responsible for invoking the Flutter tool backend. It uses a phony output file to ensure the command runs on every build. The command executes the 'tool_backend.bat' script with specified platform and configuration, generating essential Flutter build artifacts like the DLL, headers, and wrapper source files. ```cmake # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Configure CMake Project for CXX Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/runner/CMakeLists.txt This snippet sets up the CMake project, specifying the minimum required version and the project name. It defines the project's language as CXX (C++). This is the foundation for building the Flutter runner application. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) ``` -------------------------------- ### Reminder Management API Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Manages skincare routine reminders, allowing users to set customizable reminders with specific times, frequencies, and days. ```APIDOC ## POST /api/reminders ### Description Creates a new skincare routine reminder. ### Method POST ### Endpoint /api/reminders ### Parameters #### Query Parameters None #### Request Body - **name** (string) - Required - The name of the reminder (e.g., 'Morning Routine'). - **time** (string) - Required - The time for the reminder in 24-hour format (HH:MM). - **frequency** (string) - Required - The frequency of the reminder ('daily', 'weekly', 'monthly'). - **selected_days** (array of integers) - Required for 'weekly' frequency - Days of the week the reminder should be active (1=Monday, 7=Sunday). ### Request Example ```json { "name": "Morning Routine", "time": "07:30", "frequency": "weekly", "selected_days": [1, 2, 3, 4, 5] } ``` ### Response #### Success Response (200) - Returns a confirmation of the created reminder. ## GET /api/reminders/{reminderId} ### Description Retrieves a specific reminder by its ID. ### Method GET ### Endpoint /api/reminders/{reminderId} ### Parameters #### Path Parameters - **reminderId** (int) - Required - The ID of the reminder to retrieve. ### Response #### Success Response (200) - Returns the details of the specified reminder. ## PUT /api/reminders/{reminderId} ### Description Updates an existing reminder. ### Method PUT ### Endpoint /api/reminders/{reminderId} ### Parameters #### Path Parameters - **reminderId** (int) - Required - The ID of the reminder to update. #### Request Body - **name** (string) - Optional - Updated name of the reminder. - **time** (string) - Optional - Updated time for the reminder (HH:MM). - **frequency** (string) - Optional - Updated frequency ('daily', 'weekly', 'monthly'). - **selected_days** (array of integers) - Optional - Updated days of the week for the reminder. ### Request Example ```json { "name": "Updated Morning Routine", "time": "08:00" } ``` ### Response #### Success Response (200) - Returns a confirmation of the updated reminder. ## POST /api/reminders/{reminderId}/toggle ### Description Toggles the active status of a reminder (enables or disables it). ### Method POST ### Endpoint /api/reminders/{reminderId}/toggle ### Parameters #### Path Parameters - **reminderId** (int) - Required - The ID of the reminder to toggle. ### Response #### Success Response (200) - Returns a confirmation of the reminder's toggled status. ``` -------------------------------- ### CMake: Find and Check GTK Dependencies Source: https://github.com/umerfarooq-ai/glowzel/blob/main/linux/flutter/CMakeLists.txt Uses PkgConfig to find and check for the required GTK development libraries (gtk+-3.0, glib-2.0, gio-2.0). This ensures that the necessary GTK components are available for the Flutter build. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### Skin Analysis API Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Analyze skin health by uploading an image and receive personalized skincare routines and recommendations. Also allows retrieval of past analysis data. ```APIDOC ## POST /api/skin-analysis ### Description Analyzes skin health using an uploaded image and generates personalized AM/PM skincare routines and recommendations. ### Method POST ### Endpoint /api/skin-analysis ### Parameters #### Query Parameters None #### Request Body - **user_id** (int) - Required - The ID of the user. - **analysis_date** (string) - Required - The date of the analysis (YYYY-MM-DD). - **image** (file) - Required - The image file of the skin. ### Request Example ```json { "userId": 123, "analysisDate": "2024-01-15", "image": "" } ``` ### Response #### Success Response (200) - **scanId** (string) - The unique identifier for the scan. - **skinHealthMatrix** (object) - Contains metrics like hydration, oiliness, texture, and wrinkles. - **amRoutine** (array) - A list of steps for the morning skincare routine. - **pmRoutine** (array) - A list of steps for the evening skincare routine. - **nutritionRecommendations** (string) - Dietary advice for skin health. - **productRecommendations** (string) - Recommended skincare products. - **ingredientRecommendations** (string) - Recommended skincare ingredients. #### Response Example ```json { "scanId": "scan_abc123", "skinHealthMatrix": {"hydration": 75, "oiliness": 45, "texture": 80, "wrinkles": 20}, "amRoutine": [{"step": 1, "product": "Cleanser", "instruction": "..."}], "pmRoutine": [{"step": 1, "product": "Makeup Remover", "instruction": "..."}], "nutritionRecommendations": "Increase water intake...", "productRecommendations": "Use SPF 50 sunscreen...", "ingredientRecommendations": "Look for hyaluronic acid..." } ``` ## GET /api/skin-analysis/{scanId} ### Description Retrieves a specific past skin analysis based on the provided scan ID. ### Method GET ### Endpoint /api/skin-analysis/{scanId} ### Parameters #### Path Parameters - **scanId** (string) - Required - The ID of the skin analysis scan to retrieve. ### Response #### Success Response (200) Returns the `SkinAnalysisResponse` object for the specified scan ID. ## GET /api/skin-analysis/user/{userId}/history ### Description Fetches the skin analysis history for a specific user. ### Method GET ### Endpoint /api/skin-analysis/user/{userId}/history ### Parameters #### Path Parameters - **userId** (int) - Required - The ID of the user whose history to fetch. #### Query Parameters - **limit** (int) - Optional - The maximum number of history entries to return (default 50). - **skip** (int) - Optional - The number of history entries to skip (default 0). ### Response #### Success Response (200) - Returns a list of past skin analysis entries for the user. ``` -------------------------------- ### Analyze Skin with Image Upload (Dart) Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Analyzes skin health using an uploaded image and generates personalized skincare routines. It requires user ID, analysis date, and the image file. The API endpoint is POST /api/skin-analysis. It returns scan ID, skin health metrics, AM/PM routines, and recommendations. ```dart import 'dart:io'; import 'package:Glowzel/module/scan/model/skin_analysis_input.dart'; import 'package:Glowzel/module/scan/model/skin_analysis_response.dart'; // Capture or select image for analysis final File skinImage = File('/path/to/skin/image.jpg'); // Create skin analysis input final skinAnalysisInput = SkinAnalysisInput( userId: 123, analysisDate: '2024-01-15', image: skinImage, ); // Submit for analysis - uses multipart form data final analysisResponse = await authRepository.analyzeSkin(skinAnalysisInput); // POST /api/skin-analysis (multipart/form-data) // Form fields: user_id (int), analysis_date (string), image (file) // Response structure: // SkinAnalysisResponse( // scanId: "scan_abc123", // skinHealthMatrix: {"hydration": 75, "oiliness": 45, "texture": 80, "wrinkles": 20}, // amRoutine: [{"step": 1, "product": "Cleanser", "instruction": "..."}], // pmRoutine: [{"step": 1, "product": "Makeup Remover", "instruction": "..."}], // nutritionRecommendations: "Increase water intake...", // productRecommendations: "Use SPF 50 sunscreen...", // ingredientRecommendations: "Look for hyaluronic acid..." // ) // Retrieve previous skin analysis by scan ID final previousAnalysis = await authRepository.getSkinHealth('scan_abc123'); // GET /api/skin-analysis/scan_abc123 // Fetch user's skin analysis history final skinHistory = await authRepository.fetchUserSkinHistory(); // GET /api/skin-analysis/user/{userId}/history?limit=50&skip=0 // Returns: List> with all past analyses ``` -------------------------------- ### Build Flutter C++ Wrapper for Runner (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/flutter/CMakeLists.txt This CMake snippet defines a static library target 'flutter_wrapper_app' for the Flutter application runner. It includes core implementation files and application-specific engine and view controller files. This library links against the main 'flutter' library and exposes necessary headers, providing the foundation for the Flutter engine's integration within the application. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/\") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/\") # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### Manage Skincare Reminders (Dart) Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Enables users to set and manage skincare routine reminders. Supports customizable names, times, frequencies (daily, weekly, monthly), and specific days. The API endpoint for creation is POST /api/reminders. It allows for retrieval, update, and toggling of reminders. ```dart import 'package:Glowzel/module/diary/model/reminder_input.dart'; // Create a skincare reminder final reminderInput = ReminderInput( name: 'Morning Routine', time: '07:30', // 24-hour format frequency: 'weekly', // 'daily', 'weekly', 'monthly' selectedDays: [1, 2, 3, 4, 5], // 1=Monday, 7=Sunday ); // Submit the reminder final reminderResponse = await authRepository.createReminder(reminderInput); // POST /api/reminders // Body: {"name": "Morning Routine", "time": "07:30", // "frequency": "weekly", "selected_days": "1,2,3,4,5"} // Get a specific reminder final reminder = await authRepository.getReminder(789); // GET /api/reminders/789 // Update an existing reminder final updatedReminder = await authRepository.updateReminder( reminderId: 789, input: { 'name': 'Updated Morning Routine', 'time': '08:00', }, ); // PUT /api/reminders/789 // Toggle reminder on/off final toggleResult = await authRepository.toggleReminder(789); // POST /api/reminders/789/toggle ``` -------------------------------- ### Configure Flutter Library and Headers (CMake) Source: https://github.com/umerfarooq-ai/glowzel/blob/main/windows/flutter/CMakeLists.txt This snippet configures the Flutter library and its associated header files. It sets the path to the Flutter DLL and ICU data file, and defines a list of header files required for Flutter integration. It then creates an INTERFACE library target named 'flutter' and links it against the Flutter DLL, making its headers available to other targets. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/\") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Manage Session and Secure Storage Source: https://context7.com/umerfarooq-ai/glowzel/llms.txt Provides functionality to manage authentication state, tokens, and user identifiers using SharedPreferences for general data and flutter_secure_storage for sensitive information. It includes methods for checking login status, token/ID management, and persistence of daily routine toggles. ```dart import 'package:Glowzel/module/authentication/repository/session_repository.dart'; // Check login status bool isLoggedIn = sessionRepository.isLoggedIn(); // Token management await sessionRepository.setToken('eyJhbG...'); String? token = await sessionRepository.getToken(); await sessionRepository.removeToken(); // User ID management await sessionRepository.setId('user_123'); String? userId = await sessionRepository.getId(); // Scan ID for skin analysis tracking await sessionRepository.setScanId('scan_abc123'); String? scanId = await sessionRepository.getScanId(); // Daily log ID tracking await sessionRepository.setLogId('log_456'); String? logId = await sessionRepository.getLogId(); // Routine toggle persistence (per date) await sessionRepository.setMorningToggleForDate( DateTime.now(), [true, true, false, true, false], // completed steps ); List? morningToggles = await sessionRepository.getMorningToggleForDate(DateTime.now()); await sessionRepository.setEveningToggleForDate(DateTime.now(), [true, true, true]); List? eveningToggles = await sessionRepository.getEveningToggleForDate(DateTime.now()); // Clear all local data await sessionRepository.clearLocalStorage(); ```