**What** - Catches unique constraints on customer_id, is_default_billing/is_default_shipping and reformats - Adds an step to create and update of addresses that unsets the previous default shipping/billing address if necessary. - This creates a behavior in the API where you can always set an address to be default and it will automatically unset the previous one for you.
5 lines
173 B
TypeScript
5 lines
173 B
TypeScript
import { PostgresError } from "./postgres-error"
|
|
export const isDuplicateError = (err: Error & { code?: string }) => {
|
|
return err.code === PostgresError.DUPLICATE_ERROR
|
|
}
|