Customers
Customer and customer address collections
Customers
customers
Stores customer information. Supports repurchase tracking and address book management.
| Field | Type | Description | Required |
|---|---|---|---|
name | text | Customer name | ✓ |
email | Email (unique per tenant, indexed) | ||
phone | text | Phone number (indexed) | |
authProvider | select | Auth provider (local, google, apple, kakao, naver) | |
socialId | text | Social login ID (indexed) | |
marketingConsent | checkbox | Marketing email consent | |
consentedAt | date | Consent date (auto-set) | |
note | textarea | Notes | |
metadata | json | Metadata (custom data) | |
orders | join | Order history (orders) | |
addresses | join | Address book (customer-addresses) |
// Create a customer
const customer = await client.from('customers').create({
name: 'John Doe',
email: 'john@example.com',
phone: '010-1234-5678'
})
// Find customer by email
const response = await client.from('customers').find({
where: { email: { equals: 'john@example.com' } }
})customer-addresses
Stores customer shipping addresses. Supports default address selection.
| Field | Type | Description | Required |
|---|---|---|---|
customer | relationship | Customer reference (customers) | ✓ |
label | text | Address label (e.g., "Home", "Office") | |
recipientName | text | Recipient name | |
phone | text | Phone number | |
postalCode | text | Postal code | |
address1 | text | Address | |
address2 | text | Detailed address | |
isDefault | checkbox | Default address (default: false) | |
deliveryMessage | text | Delivery message |
// Get customer addresses
const response = await client.from('customer-addresses').find({
where: { customer: { equals: customerId } }
})
// Get default address
const response = await client.from('customer-addresses').find({
where: {
customer: { equals: customerId },
isDefault: { equals: true }
}
})