# Mylooq API (Node.js + MongoDB)

Node.js conversion of the PHP APIs defined in `include_webservice_shark.php` and `include/include_webservice_general.php`. Each API is exposed as a **named route by type** and uses MongoDB via Mongoose models.

## Setup

- Node.js 18+
- MongoDB running locally or set `MONGODB_URI`

```bash
cd mylooq-api
npm install
```

Create a `.env` file (optional):

```
PORT=3000
MONGODB_URI=mongodb://localhost:27017/mylooq
```

## Run

```bash
npm start
# or
npm run dev
```

## API Usage

### Named routes (by type)

Each PHP `$type` is a route name. Send **POST** to `/api/:type` with the same parameters you used in the PHP request (body or query).

Examples:

- `POST /api/language_label` — body: `{ "vCode": "EN" }`
- `POST /api/generalConfigData` — body: `{ "UserType": "Passenger", "vLang": "EN" }`
- `POST /api/signup` — body: `{ "vFirstName", "vLastName", "vEmail", "vPassword", "UserType": "Passenger", ... }`
- `POST /api/signIn` — body: `{ "vEmail", "vPassword", "UserType": "Passenger", ... }`
- `POST /api/getDetail` — body: `{ "iUserId", "UserType": "Passenger" }`
- `POST /api/countryList` — no body required
- … and all other types from `include_webservice_shark.php` and `include_webservice_general.php`

### Legacy single endpoint (PHP-style)

- `POST /api/webservice` — body must include `function` or `type` with the API name, plus any other parameters.

  Example: `{ "function": "language_label", "vCode": "EN" }`

## Structure

- **Models** (`src/models/`) — Mongoose schemas (User, Driver, LanguageLabel, LanguageMaster, Country, Currency, CabRequest, Trip, ServiceCategory, Page, DriverVehicle, VehicleType, Booking).
- **Controllers** (`src/controllers/`) — `webserviceSharkController.js` (types from include_webservice_shark), `webserviceGeneralController.js` (types from include_webservice_general). Implemented: `language_label`, `generalConfigData`, `signup`, `signIn`, `getDetail`, `countryList`. Others are stubs you can fill in.
- **Routes** (`src/routes/webserviceRoutes.js`) — `POST /api/webservice` and `POST /api/:type` dispatch by type to the correct controller.

## API types (from include_webservice_shark.php)

language_label, generalConfigData, signup, signIn, getDetail, getReceipt, loadAvailableCab, getDriverStates, CheckPromoCode, estimateFare, estimateFareNew, getEstimateFareDetailsArr, updateUserProfileDetail, getMemberBookings, getRideHistory, submitRating, loadDriverFeedBack, loadEmergencyContacts, addEmergencyContacts, deleteEmergencyContacts, sendAlertToEmergencyContacts, displayDocList, uploaddrivedocument, callOnLogout, getCabRequestAddress, submitTripHelpDetail, GetCancelReasons, getCallMaskNumber, UpdateUserWalletAdjustment, DisplayCouponList, getYearTotalEarnings, requestResetPassword, cancelCabRequest, sendRequestToDrivers, cancelTrip, GenerateTrip, DriverArrived, StartTrip, ProcessEndTrip, CollectPayment, ScheduleARide, displayFare, getDriverRideHistory, checkBookings, CheckSourceLocationState, cancelBooking, DeclineTripRequest, generateReviewModeLogin, updateDriverStatus, getDriverLocations, LoadAvailableCars, SetDriverCarID, updateDriverLocations, updateTripLocations, checkSurgePrice, getUserVehicleDetails, UpdateDriverVehicle, getOngoingUserTrips, getTripDeliveryLocations, SetTimeForTrips, UpdateBookingStatus, DisplayUserAddress, DisplayScheduleBookingDetail, Checkpickupdropoffrestriction, UpdateBookingDateRideDelivery, ChargePassengerOutstandingAmount, getOutstandingAmount, getServiceCategories, getServiceCategoryDetails, getMemberTripDetails, sendChargeVerificationCode, getApprovalStatus, getBanners, UploadIdProof, getOnlineDriversRideDelivery, SearchService, getDriverStats, getServiceCategoriesProOld, getServiceCategoriesPro, getAllServiceCategories, getDriverRewardInfo, UploadServiceSafetyMedia, getNearByPlaces, UpdateRideStatus

## API types (from include_webservice_general.php)

countryList, isUserExist, LoginWithFB, LoginWithAppleID, staticPage, sendContactQuery, getFAQ, uploadImage, updatePassword, sendVerificationSMS, getTransactionHistory, createWithdrawlRequest, changelanguagelabel, checkUserStatus, GetMemberWalletBalance, getHelpDetailCategoty, getsubHelpdetail, getHelpDetail, sendVerificationEmail, DriverBankDetails, SendTripMessageNotification, getMemberServiceDetails, SetMemberServiceDetails, SendServiceMessageNotification, configDriverTripStatus, configPassengerTripStatus, configPassengerTripStatusWeb, loadPassengersLocation, deletedrivervehicle, displaydrivervehicles, UpdateUserVehicleDetails, displayuservehicles, getDriverDetail, UpdateUserAddressDetails, DeleteUserAddressDetail, Checkuseraddressrestriction, UpdateUserFavouriteAddress, DeleteUserFavouriteAddress, fetchAPIDetails, CheckOutOrderEstimateDetailsGenie, CheckAppTerminate, GetProfilePaymentDetails, getTwilioAccessToken, sendNotificationForTwilio, sendAuthOtp, AccountDelete, SignInForAccountDelete, SendGiftCard, RedeemGiftCard, PreviewGiftCard, AuthenticateMember, CheckMemberAccount, UpdateLiveActivityToken, UpdateVoipDeviceToken, SendVoipNotification, sendServiceRequestToDrivers, sendRequestTimeoutNotification, loadStaticInfo, loadStaticPages, SetFaqs, SetCancelReasons, loadAppImages, getUserVehicleMakeDetails, getUserVehicleModelsDetails, getDriverVehicleDetails, displayWayBill, getAdvertisementBanners, insertBannereImpressionCount, getNewsNotification, UpdateWalletBalanceStatus, getDriverTrainingVideos
