---
# System prepended metadata

title: Place Suggestion for Staff

---

# Place Suggestion for Staff

## 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];

```

### Review place suggestion

#### Curl

```json
curl --location --request PATCH 'http://localhost:5001/hybrid-dbs-stag/asia-southeast1/api/v1/place-suggestions/ea850a87-3c34-4eaf-908d-88de3574ad37/review' \
--header 'x-auth-role: staff' \
--header 'Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJyb2xlTGlzdCI6WyJzdGFmZiJdLCJlbWFpbCI6InRlc3RAc3RhZmYuY29tIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJhdXRoX3RpbWUiOjE2ODA3NjkwOTIsInVzZXJfaWQiOiJ0ZXN0QHN0YWZmLmNvbSIsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsidGVzdEBzdGFmZi5jb20iXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwYXNzd29yZCJ9LCJpYXQiOjE2ODA3NjkwOTIsImV4cCI6MTY4MDc3MjY5MiwiYXVkIjoiaHlicmlkLWRicy1zdGFnIiwiaXNzIjoiaHR0cHM6Ly9zZWN1cmV0b2tlbi5nb29nbGUuY29tL2h5YnJpZC1kYnMtc3RhZyIsInN1YiI6InRlc3RAc3RhZmYuY29tIn0.' \
--header 'Content-Type: application/json' \
--data '{
    "status": "rejected",
    "position": {
        "latitude": 10.217050383048822,
        "longitude": 103.96465761394057
    },
    "name": "Quang HD",
    "address": "1234 Ngô Quyền",
    "categoryList": [
        "hotel",
        "restaurant"
    ],
    "phoneNumber": null,
    "note": null,
    "staffComment": "Chưa tốt lắm",
    "priority": "medium"
}'
```

#### Validator

```typescript
export class ReviewPlaceSuggestionDto {
  status: PlaceSuggestionStatus;
  position: PositionDto;
  name: string;
  address: string | null;
  categoryList: PlaceCategoryType[];
  phoneNumber: string | null;
  note: string | null;
  staffComment: string | null;
  priority: PlaceSuggestionPriority | null;
}

```

#### Note

This endpoint will throw if:
- Try to approve if there has been at least 1 suggestion that has the same `placeId` that has been approved.
- Try to un-approve an approved suggestion (`oldStatus === 'approved' && newStatus !== 'approved'`)

## Settings

Add a new field `placeSuggestionRewardAmount: number;` for both the SettingsSchema & the update-settings endpoint.
