create (Addresses/validation.js)

SneakerBot · api/Addresses/validation.js · javascript · MIT
payments

Defines Joi schemas for address CRUD operations.

// Source: https://github.com/samc621/SneakerBot | License: MIT | Copyright 2021 Samuel Corso
// Provided via justclaw.it.com; keep this notice with the code.
import { Joi } from 'express-validation';

export const create = {
  body: Joi.object({
    type: Joi.string().valid('billing', 'shipping').required(),
    first_name: Joi.string().required(),
    last_name: Joi.string().required(),
    address_line_1: Joi.string().required(),
    address_line_2: Joi.string().allow('').optional(),
    city: Joi.string().required(),
    state: Joi.string().required(),
    postal_code: Joi.string().required(),
    country: Joi.string().required(),
    email_address: Joi.string().email().required(),
    phone_number: Joi.string().required()
  })
};

export const findOne = {
  params: Joi.object({
    id

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key