# Place Suggestion for Driver
## Place Suggestion
### Collection path
`"/placeSuggestions/"`
### Schema
```typescript
export interface PlaceSuggestionSchema {
id: string;
createdAt: Timestamp;
updatedAt: Timestamp;
/** This is from Google Maps API. Each of the google's place will have a unique id. */
placeId: string;
status: PlaceSuggestionStatus;
driverAuthInfo: DriverAuthInfo;
driver: DriverSnapshotSchema | null;
position: PositionSchema;
name: string;
address: string | null;
categoryList: PlaceCategoryType[];
imageUrlList: string[];
phoneNumber: string | null;
note: string | null;
originalPlace: OriginalPlaceSchema;
/** Reviewer */
staffAuthInfo: StaffAuthInfo | null;
staff: StaffSnapshotSchema | null;
// == Update by reviewer
staffComment: string | null;
priority: PlaceSuggestionPriority | null;
hasSynced: boolean;
}
export interface OriginalPlaceSchema {
name: string | null;
address: string | null;
}
export const placeSuggestionStatusList = [
'waitingForApproval',
'approved',
'rejected',
] as const;
export type PlaceSuggestionStatus = (typeof placeSuggestionStatusList)[number];
export const placeCategoryTypeList = [
'house',
'hotel',
'restaurant',
'company',
'entertainment',
'office',
'other',
] as const;
export type PlaceCategoryType = (typeof placeCategoryTypeList)[number];
export const placeSuggestionPriorityList = ['high', 'medium', 'low'] as const;
export type PlaceSuggestionPriority =
(typeof placeSuggestionPriorityList)[number];
```
### Create place suggestion
#### Curl
```json
curl --location 'http://localhost:5001/hybrid-dbs-stag/asia-southeast1/api/v1/place-suggestions' \
--header 'x-auth-role: driver' \
--header 'x-driver-account-type: bike' \
--header 'Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJyb2xlTGlzdCI6WyJkcml2ZXIiXSwiZW1haWwiOiJ0ZXN0QGRyaXZlci5jb20iLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsInBob25lX251bWJlciI6Iis4NDk4NzY1NDMyMSIsImF1dGhfdGltZSI6MTY4MDc2OTA2MiwidXNlcl9pZCI6InRlc3RAZHJpdmVyLmNvbSIsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsidGVzdEBkcml2ZXIuY29tIl0sInBob25lIjpbIis4NDk4NzY1NDMyMSJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn0sImlhdCI6MTY4MDc2OTA2MiwiZXhwIjoxNjgwNzcyNjYyLCJhdWQiOiJoeWJyaWQtZGJzLXN0YWciLCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vaHlicmlkLWRicy1zdGFnIiwic3ViIjoidGVzdEBkcml2ZXIuY29tIn0.' \
--header 'Content-Type: application/json' \
--data '{
"placeId": "abc123",
"position": {
"latitude": 10.217050383048822,
"longitude": 103.96465761394057
},
"name": "Quang HD",
"address": "123 Ngô Quyền",
"categoryList": [
"hotel",
"restaurant"
],
"imageUrlList": [
"https://mogi.vn/news/wp-content/uploads/2022/02/so-nha-7.jpeg"
],
"phoneNumber": null,
"note": null,
"originalPlace": {
"name": null,
"address": "6X87+RVC, TT. Dương Đông, Phú Quốc, Kiên Giang, Vietnam"
}
}'
```
#### Validator
```typescript
export class CreatePlaceSuggestionDto {
placeId: string;
position: PositionDto;
name: string;
address: string | null;
categoryList: PlaceCategoryType[];
imageUrlList: string[];
phoneNumber: string | null;
note: string | null;
originalPlace: OriginalPlaceDto;
}
```
#### Note
This endpoint will throw if there has been at least 1 suggestion that has the same `placeId` that has been approved.
## Transactions
Add 1 type of Transaction: `RewardDriverTransaction`
### Schema
```typescript
export interface RewardDriverTransactionSchema
extends BaseDriverTransactionSchema {
type: 'reward';
metadata: RewardDriverTransactionMetadata;
}
export interface RewardDriverTransactionMetadata {
placeSuggestionId: string;
}
```