extract queries to files

This commit is contained in:
Chika 2020-12-08 20:13:58 +03:00
parent f8797c287f
commit 6c02ef38cd
3 changed files with 162 additions and 157 deletions

View File

@ -11,163 +11,8 @@ import { currentDate } from 'client/tools/date';
import { NIL } from 'uuid';
import { Process } from 'core/types/Calculation/Store/process';
import { calculationProcess } from 'client/stores/CalculationStore';
const quoteQuery = gql`
query($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
${Object.values(mapKPtoValues).join(' ')}
evo_addproduct_types {
evo_product_type
evo_addproduct_typeid
}
evo_osago_accountid
evo_kasko_accountid
evo_osago_payer
evo_kasko_payer
evo_osago_price
evo_kasko_price
evo_dgo_price
evo_ns_price
evo_insurance_period
evo_graphs {
createdon
evo_planpayments {
evo_payment_ratio
}
}
}
}
`;
const optionsQuery = gql`
query(
$statecode: Int
$evo_brandid: Uuid
$evo_modelid: Uuid
$salonaccountid: Uuid!
$currentDate: DateTime
$dealer_person_accountid: Uuid!
$dealer_broker_accountid: Uuid!
$ind_agent_accountid: Uuid!
$double_agent_accountid: Uuid!
$broker_accountid: Uuid!
$findepartment_accountid: Uuid!
$evo_gps_brandid: Uuid!
$evo_regionid: Uuid!
) {
selectModel: evo_models(statecode: $statecode, evo_brandid: $evo_brandid) {
evo_name
evo_modelid
evo_leasingobject_risk
evo_importer_reward_perc
evo_importer_reward_rub
evo_impairment_groupid
}
selectConfiguration: evo_equipments(
statecode: $statecode
evo_modelid: $evo_modelid
) {
evo_equipmentid
evo_name
evo_impairment_groupid
evo_leasingobject_risk
evo_start_production_year
}
selectDealerPerson: salon_providers(
statecode: $statecode
salonaccountid: $salonaccountid
) {
accountid
name
evo_broker_accountid
}
selectDealerRewardCondition: evo_reward_conditions(
evo_agent_accountid: $dealer_person_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectDealerBroker: account(accountid: $dealer_broker_accountid) {
accountid
name
}
selectDealerBrokerRewardCondition: evo_reward_conditions(
evo_agent_accountid: $dealer_broker_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectIndAgentRewardCondition: evo_reward_conditions(
evo_agent_accountid: $ind_agent_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_double_agent_accountid
evo_reward_summ
evo_reduce_reward
}
calcDoubleAgentRewardCondition: evo_reward_conditions(
evo_agent_accountid: $double_agent_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
calcBrokerRewardCondition: evo_reward_conditions(
evo_agent_accountid: $broker_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectFinDepartmentRewardCondtion: evo_reward_conditions(
evo_agent_accountid: $findepartment_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectGPSModel: evo_gps_models(
statecode: $statecode
evo_gps_brandid: $evo_gps_brandid
) {
evo_name
evo_gps_modelid
}
selectTownRegistration: evo_towns(
statecode: $statecode
evo_regionid: $evo_regionid
) {
evo_name
evo_townid
}
}
`;
import quoteQuery from './quoteQuery';
import optionsQuery from './optionsQuery';
const map_add_product_types_to_values = {
technicalCard: 100000000,

View File

@ -0,0 +1,131 @@
import { gql } from '@apollo/client';
export default gql`
query(
$statecode: Int
$evo_brandid: Uuid
$evo_modelid: Uuid
$salonaccountid: Uuid!
$currentDate: DateTime
$dealer_person_accountid: Uuid!
$dealer_broker_accountid: Uuid!
$ind_agent_accountid: Uuid!
$double_agent_accountid: Uuid!
$broker_accountid: Uuid!
$findepartment_accountid: Uuid!
$evo_gps_brandid: Uuid!
$evo_regionid: Uuid!
) {
selectModel: evo_models(statecode: $statecode, evo_brandid: $evo_brandid) {
evo_name
evo_modelid
evo_leasingobject_risk
evo_importer_reward_perc
evo_importer_reward_rub
evo_impairment_groupid
}
selectConfiguration: evo_equipments(
statecode: $statecode
evo_modelid: $evo_modelid
) {
evo_equipmentid
evo_name
evo_impairment_groupid
evo_leasingobject_risk
evo_start_production_year
}
selectDealerPerson: salon_providers(
statecode: $statecode
salonaccountid: $salonaccountid
) {
accountid
name
evo_broker_accountid
}
selectDealerRewardCondition: evo_reward_conditions(
evo_agent_accountid: $dealer_person_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectDealerBroker: account(accountid: $dealer_broker_accountid) {
accountid
name
}
selectDealerBrokerRewardCondition: evo_reward_conditions(
evo_agent_accountid: $dealer_broker_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectIndAgentRewardCondition: evo_reward_conditions(
evo_agent_accountid: $ind_agent_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_double_agent_accountid
evo_reward_summ
evo_reduce_reward
}
calcDoubleAgentRewardCondition: evo_reward_conditions(
evo_agent_accountid: $double_agent_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
calcBrokerRewardCondition: evo_reward_conditions(
evo_agent_accountid: $broker_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectFinDepartmentRewardCondtion: evo_reward_conditions(
evo_agent_accountid: $findepartment_accountid
evo_datefrom_param: { lte: $currentDate }
evo_dateto_param: { gte: $currentDate }
statecode: $statecode
) {
evo_reward_conditionid
evo_name
evo_reward_summ
evo_reduce_reward
}
selectGPSModel: evo_gps_models(
statecode: $statecode
evo_gps_brandid: $evo_gps_brandid
) {
evo_name
evo_gps_modelid
}
selectTownRegistration: evo_towns(
statecode: $statecode
evo_regionid: $evo_regionid
) {
evo_name
evo_townid
}
}
`;

View File

@ -0,0 +1,29 @@
import { gql } from '@apollo/client';
import mapKPtoValues from './mapKpToValues';
export default gql`
query($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
${Object.values(mapKPtoValues).join(' ')}
evo_addproduct_types {
evo_product_type
evo_addproduct_typeid
}
evo_osago_accountid
evo_kasko_accountid
evo_osago_payer
evo_kasko_payer
evo_osago_price
evo_kasko_price
evo_dgo_price
evo_ns_price
evo_insurance_period
evo_graphs {
createdon
evo_planpayments {
evo_payment_ratio
}
}
}
}
`;