---
# System prepended metadata

title: My Supplier

---

# My Supplier
---

# Table

## organization_suppliers
- organization_id
- partner_id // di-isi ketika partner sudah registrasi atau accept invitation
- email
- status (integer, enum: 0: invited, 1: active, 2: blocked)
- token // invitation token
- expired_at
- deleted_at

---
# Endpoint

## Supplier Master List
### URL: `GET /phoenix/suppliers`
### Params
```json=
{
	"query":""
}
```
### Response
```json=
[{
	"id": ID,
	"name": "Subur Printing",
	"city_name": "Kota Administrasi Jakarta Selatan"
}]
```

## Supplier Invitation
### URL: `POST /phoenix/organization/suppliers/invite`
### Params
```json=
{
  // jika user pilih dari autocomplete
  "partner_id": 1,

  // jika user tidak menemukan supplier
  "name": "",
  "email": ""
}
```
### Response
```json=
{
  "org supplier detail"
}
```

---
## Invitation Detail
### URL: `GET /niffler/invitations/:token`
### Response
```json=
{
  "organization supplier detail"
}
```

---
## Invitation - Accept
### URL: `POST /niffler/invitations/:token/accept`
### Response
```json=
[{
  // invitation 
}]
```
### Logic
- End point ini harus require current_user dan current_partner
- Ambil partner_id dari current_partner
- Simpan partner_id ke organization_suppliers dengan token dari URL/params 
- Dan update status organization_suppliers menjadi active

---
## Block Supplier
### URL: `POST /phoenix/organization/suppliers/:id/block`
### Response
```json=
{
  "org supplier detail"
}
```

---
## Blocked Supplier list
### URL: `GET /phoenix/organization/suppliers/blocked`
### Params
```json=
{
	"query":"",
    "sort_by":"",
    "sort_direction":"",
    "page":"",
    "per":""
}
```

### Response
```json=
[{ "Org Supplier List" }]
```
---
## Active Supplier list
### URL: `GET /phoenix/organization/suppliers/active`
### Params
```json=
{
	"query":"",
    "sort_by":"",
    "sort_direction":"",
    "page":"",
    "per":""
}
```

### Response
```json=
[{ "Org Supplier List" }]
```

