Skip to content

Commit

Permalink
feat: improve the returned mapped object
Browse files Browse the repository at this point in the history
  • Loading branch information
MikolajKaminski committed Oct 30, 2024
1 parent c879e5d commit f4c7f11
Showing 1 changed file with 49 additions and 14 deletions.
63 changes: 49 additions & 14 deletions src/routes/business/businesses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ const businessObjectFields = [
"nace_code",
"legal_form",
"foundation_date",
"address",
"line_1",
"line_2",
"postal_code",
"city",
"state",
"country",
"tax_information",
"tax_country",
"tax_confirmation",
"registration_number",
"registration_issuer",
"address.line_1",
"address.line_2",
"address.postal_code",
"address.city",
"address.state",
"address.country",
"tax_information.tax_country",
"tax_information.tax_confirmation",
"tax_information.registration_number",
"tax_information.registration_issuer",
"fatca_relevant",
"fatca_crs_confirmed_at",
"crs_company_type",
Expand Down Expand Up @@ -145,7 +143,7 @@ export const showBusinesses = async (req, res) => {
};

export const updateBusiness = async (req, res) => {
const editableFields = [
const fields = [
"name",
"sector",
"industry",
Expand Down Expand Up @@ -184,11 +182,48 @@ export const updateBusiness = async (req, res) => {
"company_status",
];

const editableFields = [
"name",
"sector",
"nace_code",
"legal_form",
"foundation_date",
"address",
"line_1",
"line_2",
"postal_code",
"city",
"state",
"country",
"tax_information",
"tax_country",
"tax_confirmation",
"registration_number",
"registration_issuer",
"fatca_relevant",
"fatca_crs_confirmed_at",
"crs_company_type",
"balance_sheet_total",
"number_employees",
"registration_type",
"registration_district",
"business_purpose",
"terms_conditions_signed_at",
"branch",
"international_operativity_expectation",
"vat_number",
"purpose_of_account_opening",
"source_of_funds",
"expected_annual_revenue",
"expected_annual_incoming_funds",
"company_status",
];

const {
params: { business_id: businessId },
body,
} = req;
const data = _.pick(body, businessObjectFields);
const data = _.pick(body, fields);

let business;
const businessLockKey = `redlock:${process.env.MOCKSOLARIS_REDIS_PREFIX}:business:${businessId}`;
Expand Down

0 comments on commit f4c7f11

Please sign in to comment.