# Backend API Spec (11/18) ## DB :::danger 具體DB要的欄位跟table可否開出來? (尤其是跟journey有關的) ::: ### user | id | user name | phone number | email | verify token | email varified | wallet address | | ------ | --------- | ------------ | ------ | ------------ | -------------- | -------------- | | number | string | string | string | string | boolean | string | ### driver | id | driver name | driving license | taxi license | phone number | email | address | wallet address | inspect status | driver type | company Id | bank name | bank branch name | bank account name | bank account number | driver available | | ------ | ----------- | --------------- | ------------ | ------------ | ------ | ------- | -------------- | -------------- | ------------ | ---------- | --------- | ---------------- | ----------------- | ------------------- | --- | | number | string | string | string | string | string | string | string | boolean | enum/string? | number | string | string | string | string | boolean | ### journey search | id | from latitude | from longitude | to latitude | to longitude | pickupTime | rideType | passenger id | | ------ | ------------- | -------------- | ----------- | ------------ | ---------- | -------- | --- | | number | string | string | string | string | date & time | enum | number | ### journey request | id | journey search id | timestamp | | ------ | ----------------- | --- | | number | number | date & time | ### journey | id | journey request id | journey status | start coordinate | start timestamp | passenger end coordinate | passenger end timestamp | driver end coordinate | driver end timestamp | final price | driver id | | ------ | ------------------ | -------------- | ---------------- | --------------- | ------------------------ | ---------------------- | --- | --- | --- | --------- | | number | number | enum | string | date & time | string | date & time | string | date & time | number | number | ### complaint | id | journey id | title | content | status | note | | ------ | ---------- | ------ | ------- | ------ | --- | | number | number | string | string | enum | string | --- ## endpoint :::danger common questions * notification 如何發送的問題 * BE 如何 verify signature * 計算各種費用 & 預估時間的方式 * 部分 API 並未包含在 sequence diagram 中,具體 function 內容為何? ::: --- ### passenger #### POST passenger/create :::success 01.sequence-diagiam-passenger-connect-wallet ::: * [BE] generate email verify token * [DB] insert user info to **user** table (**email varified** is false) * [email] send confirmation email #### GET passenger/login :::danger 未包含在sequence diagram,他的function具體內容是? ::: #### GET passenger/verifyEmail :::danger * 改這樣? GET passenger/verifyEmail/{verify-token} ::: :::success 01.sequence-diagiam-passenger-connect-wallet ::: * [DB] update **email varified** where **verify token** is {verify-token} to true in **user** table * [SC] issueNFTicket #### GET passenger/emailStatus :::danger * 改這樣? GET passenger/emailStatus/{wallet-address} ::: :::success 01.sequence-diagiam-passenger-connect-wallet ::: * [DB] query **email varified** where **wallet address** is {wallet-address} in **user** table --- ### driver #### POST driver/create :::success 02.sequence-diagram-driver-connect-wallet ::: :::danger * inspector 是誰? ::: * [DB] insert driver info to **driver** table (**inspect status** is false) * [notification] send notificatino to inspector #### GET driver/login :::danger 未包含在sequence diagram,他的function具體內容是? ::: #### PUT driver/status :::success 06.sequence-diagram-driver-end-journey ::: :::danger * request參數需要加上driver id ::: * [DB] update **driver available** where **driver id** is {driver-id} in **driver** table #### PUT driver/location :::danger 未包含在sequence diagram,他的function具體內容是? ::: #### ?? driver verify :::success 02-01.sequence-diagram-vehicle-inspector-verify-driver ::: :::danger * storage是什麼? * (Kenny) are we going to use in Nigeria PJ? AWS S3? * API request response還沒開出來 ::: * [storage] save file * [DB] update **inspect status** to true in **driver** table * [notification] send notification to driver --- ### journey request #### POST journey-request/search :::success 03.sequence-diagram-passenger-create-journey ::: :::danger * 計算車費的公式是? (Kenny) * request參數需要加上user id * payload需要的格式是? ::: * [BE] calculate joruney cost * [DB] insert journey search info to **journey search** table * [BE] sign payload #### GET journey-request/current :::danger 未包含在sequence diagram,他的function具體內容是? ::: #### POST journey-request/create :::success 03.sequence-diagram-passenger-create-journey ::: :::danger * request參數需要加上user id * 需要verify payload嗎? * get ticket balance要做什麼? * find nearby driver要怎麼做? 及時抓取司機位置? * (Kenny) How does BE track the current location of every driver? * (Kenny) How does BE notify nearby drivers? * (Kenny) How does BE trigger cancelService when no driver accepts a Journey? ::: * [SC] get presenter * [BE & DB] verify ticket has been present (presenter address = user wallet address) * [SC] get ticket balance * [DB] insert journey request info to **journey request** table * [notification] send passenger notification that journey request created * [BE] find nearby driver * [DB] query nearby driver's driver info from **driver** table * [notification] send notification to driver * [SC] if no driver available, return Ticket #### POST journey-request/accept :::success 03.sequence-diagram-passenger-create-journey ::: :::danger * request參數需要加上driver id * response 裡面 real pick up location, passenger/driver end location 是什麼? 如果是結束的時候才有的值,現在為什麼會在response裡面呢? * update journey request要更新什麼? * estimated time of arrival怎麼算? (Kenny) * (Kenny) How does BE notify all drivers except the accepted one? * (Kenny) How does BE notify PassengerApp that a driver is coming? ::: * [DB] insert journey info to **journey** table * [DB] update journey request info in **journey request** table * [DB] update **driver available** where **driver id** is {driver-id} in **driver** table * [notification] send notification to driver except the accepted driver that journey has been accepted * [BE] calculate estimated time of arrival * [notification] send notification to passenger ### journey #### GET journey :::danger 未包含在sequence diagram,他的function具體內容是? ::: #### GET journey/current :::danger 未包含在sequence diagram,他的function具體內容是? ::: #### GET journey/{id} :::danger 未包含在sequence diagram,他的function具體內容是? ::: #### POST journey/{id}/start :::success 04.sequence-diagram-start-journey ::: :::danger * (Kenny) How to verify passenger’s signature in BE? ::: * [DB] query passenger's wallet address * [BE] verify signature * [SC] check in * [DB] update **journey status** & save coordinate & timestamp where **id** is {id} in **journey** table #### POST journey/{id}/passengerEnd :::success 05.sequence-diagram-passenger-end-journey ::: * [DB] query passenger's wallet address * [BE] verify signature * [SC] check out * [DB] update **journey status** & save coordinate & timestamp where **id** is {id} in **journey** table * [notification] send notification to driver #### POST journey/{id}/driverEnd :::success 06.sequence-diagram-driver-end-journey ::: :::danger * (Kenny) How to verify driver’s signature in BE? * (Kenny) How does BE notify PassengerApp that a driver has ended a ride * (kenny) If the passenger pays with BLXM, is NFTIcket responsible for exchanging BLXM tokens to USDC and transfer to the driver’s pool? * final price怎麼計算? ::: * [DB] query driver's wallet address * [BE] verify signature * [BE] calculate final price * [DB] update **journey status** & save coordinate &final price & timestamp where **id** is {id} in **journey** table * [notification] send notification to passenger #### POST journey/{id}/cancel :::success 03-01.sequence-diagram-passenger-cancel-journey ::: :::danger * 計算取消費的公式是? (Kenny) * update journey request具體要更新什麼? ::: * [BE] calculate cancel fee * [DB] update **journey status** where **id** is {id} in **journey** table * [DB] update journey request * [SC] cancel service * [DB] update **journey status** where **id** is {id} in **journey** table * [DB] update journey request * [notification] send notification to driver #### POST journey/{id}/complaint :::success 10.sequence-diagram-complaint ::: * [DB] insert complaint info to **complaint** table * [SC] block driver * [notification] send notification to driver #### ??? journey/{id}/complaint/{result} :::success 10.sequence-diagram-complaint ::: :::danger * 這個具體要做什麼? * (Kenny) How does BE notify the operation? ::: * [SC] unblock driver * [DB] update **status** & **note** in **complaint** table * [notification] send notification to passenger & driver --- ### payment #### GET payment/exchangeRates :::success 07.sequence-diagram-top-up ::: :::danger * (Kenny) Where do exchange rates come from? ::: #### POST payment/creditCard #### GET payment/topUp :::success 07.sequence-diagram-top-up ::: #### POST payment/topUp #### GET payment/withdraw :::success 09.sequence-diagram-driver-withdraw ::: #### POST payment/withdraw #### GET payment/refund :::success 08.sequence-diagram-passenger-refund ::: #### POST payment/refund ###### tags: `Nigeria`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up