Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 30 additions & 29 deletions api/src/router/user/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { body, param } from "express-validator";
import { mwVaildator } from "src/middlewares";

const idInParams = [param("id").notEmpty(), mwVaildator];

const notificationIdInParams = [
param("notificationId").notEmpty(),
mwVaildator,
Expand Down Expand Up @@ -52,15 +53,15 @@ export const deposit = [...idInParams, body("amount").isString(), mwVaildator];

export const addCustomer = [
...idInParams,
body("customer.tag").isString(),
body("customer.avatar").isString(),
body("customer.address1").isString(),
body("customer.address2").isString(),
body("customer.city").isString(),
body("customer.state").isString(),
body("customer.postalCode").isString(),
body("customer.firstName").isString(),
body("customer.lastName").isString(),
body("customer.tag").optional().isString(),
body("customer.avatar").optional().isString(),
body("customer.address1").optional().isString(),
body("customer.address2").optional().isString(),
body("customer.city").optional().isString(),
body("customer.state").optional().isString(),
body("customer.postalCode").optional().isString(),
body("customer.firstName").optional().isString(),
body("customer.lastName").optional().isString(),
mwVaildator,
];

Expand All @@ -87,26 +88,26 @@ export const updateBusinessProfile = [

export const addBusiness = [
...idInParams,
body("business.story").isString(),
body("business.tag").isString(),
body("business.avatar").isString(),
body("business.type").isString(),
body("business.rbn").isString(),
body("business.industry").isString(),
body("business.ein").isString(),
body("business.address1").isString(),
body("business.address2").isString(),
body("business.city").isString(),
body("business.state").isString(),
body("business.postalCode").isString(),
body("business.phoneNumber").isString(),
body("business.owner.firstName").isString(),
body("business.owner.lastName").isString(),
body("business.owner.address1").isString(),
body("business.owner.address2").isString(),
body("business.owner.city").isString(),
body("business.owner.state").isString(),
body("business.owner.postalCode").isString(),
body("business.story").optional().isString(),
body("business.tag").optional().isString(),
body("business.avatar").optional().isString(),
body("business.type").optional().isString(),
body("business.rbn").optional().isString(),
body("business.industry").optional().isString(),
body("business.ein").optional().isString(),
body("business.address1").optional().isString(),
body("business.address2").optional().isString(),
body("business.city").optional().isString(),
body("business.state").optional().isString(),
body("business.postalCode").optional().isString(),
body("business.phoneNumber").optional().isString(),
body("business.owner.firstName").optional().isString(),
body("business.owner.lastName").optional().isString(),
body("business.owner.address1").optional().isString(),
body("business.owner.address2").optional().isString(),
body("business.owner.city").optional().isString(),
body("business.owner.state").optional().isString(),
body("business.owner.postalCode").optional().isString(),
mwVaildator,
];

Expand Down
18 changes: 9 additions & 9 deletions api/src/service/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ async function createCustomer(
verifiedCustomer: true,
verifiedBusiness: false,
customer: {
firstName: input.customer.firstName,
lastName: input.customer.lastName,
address1: input.customer.address1,
address2: input.customer.address2,
city: input.customer.city,
state: input.customer.state,
postalCode: input.customer.postalCode,
avatar: input.customer.avatar,
tag: input.customer.tag,
firstName: input?.customer?.firstName || '',
lastName: input?.customer?.lastName || '',
address1: input?.customer?.address1 || '',
address2: input?.customer?.address2 || '',
city: input?.customer?.city || '',
state: input?.customer?.state || '',
postalCode: input?.customer?.postalCode || '',
avatar: input?.customer?.avatar || '',
tag: input?.customer?.tag || '',
},
email: input.email,
});
Expand Down