Comments Added
This commit is contained in:
parent
df880c2f4c
commit
00aeae2b04
@ -27,6 +27,7 @@ const seedDB = async () => {
|
||||
|
||||
try {
|
||||
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env;
|
||||
//Route pullung specific data points from ASPIRE API
|
||||
const apiUrl = `https://cloud-api.youraspire.com/Contacts?%24select=ContactID%2CCompanyName%2CContactTypeName%2CFirstName%2CLastName%2CEmail%2CMobilePhone`;
|
||||
const headers = {
|
||||
'Authorization': `Bearer ${ASPIRE_TOKEN}`,
|
||||
@ -38,8 +39,7 @@ const seedDB = async () => {
|
||||
|
||||
//save to database before going to client
|
||||
// therefore logic to have databse filter logic beofre going to client
|
||||
// await contacts.save();
|
||||
// Save each work ticket visit to the database
|
||||
|
||||
for (const contactPerson of contactArray) {
|
||||
const contact = new Contact({
|
||||
ContactID: contactPerson.ContactID,
|
||||
|
@ -27,6 +27,7 @@ const seedDB = async () => {
|
||||
|
||||
try {
|
||||
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env;
|
||||
//Route pullung specific data points from ASPIRE API
|
||||
const apiUrl = `https://cloud-api.youraspire.com/Opportunities?%24select=OpportunityID%2CPropertyID%2COpportunityStatusName%2CBranchName&%24filter=OpportunityStatusName%20eq%20%27won%27`;
|
||||
const headers = {
|
||||
'Authorization': `Bearer ${ASPIRE_TOKEN}`,
|
||||
@ -38,8 +39,8 @@ const seedDB = async () => {
|
||||
|
||||
//save to database before going to client
|
||||
// therefore logic to have databse filter logic beofre going to client
|
||||
// await contacts.save();
|
||||
// Save each work ticket visit to the database
|
||||
|
||||
|
||||
for (const wonOpportunity of opportunityArray) {
|
||||
const opportunity = new Opportunity({
|
||||
OpportunityID: wonOpportunity.OpportunityID,
|
||||
|
@ -26,6 +26,7 @@ const seedDB = async () => {
|
||||
|
||||
try {
|
||||
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env;
|
||||
//Route pullung specific data points from ASPIRE API
|
||||
const apiUrl = `https://cloud-api.youraspire.com/Properties?%24select=PropertyID%2CBranchName%2CPropertyStatusName%2CPropertyAddressLine1%2CPropertyAddressLine2%2CPropertyAddressCity%2CPropertyAddressStateProvinceCode%2CPropertyAddressZipCode`;
|
||||
const headers = {
|
||||
'Authorization': `Bearer ${ASPIRE_TOKEN}`,
|
||||
@ -37,8 +38,7 @@ const seedDB = async () => {
|
||||
|
||||
//save to database before going to client
|
||||
// therefore logic to have databse filter logic beofre going to client
|
||||
// await contacts.save();
|
||||
// Save each work ticket visit to the database
|
||||
|
||||
for (const propertyData of propertyArray) {
|
||||
const property = new Property({
|
||||
PropertyID: propertyData.PropertyID,
|
||||
|
@ -26,6 +26,7 @@ const seedDB = async () => {
|
||||
|
||||
try {
|
||||
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env;
|
||||
//Route pullung specific data points from ASPIRE API
|
||||
const apiUrl = `https://cloud-api.youraspire.com/PropertyContacts?%24select=PropertyID%2CContactID%2CContactName%2CCompanyName`;
|
||||
const headers = {
|
||||
'Authorization': `Bearer ${ASPIRE_TOKEN}`,
|
||||
@ -37,8 +38,7 @@ const seedDB = async () => {
|
||||
|
||||
//save to database before going to client
|
||||
// therefore logic to have databse filter logic beofre going to client
|
||||
// await contacts.save();
|
||||
// Save each work ticket visit to the database
|
||||
|
||||
for (const propertyContactData of propertyArray) {
|
||||
const property = new PropertyContact({
|
||||
PropertyID: propertyContactData.PropertyID,
|
||||
|
@ -27,6 +27,7 @@ const seedDB = async () => {
|
||||
|
||||
try {
|
||||
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN, ASPIRE_REFRESH_TOKEN } = process.env;
|
||||
//Route pullung specific data points from ASPIRE API
|
||||
const apiUrl = `https://cloud-api.youraspire.com/WorkTickets?%24select=OpportunityID%2CPrice%2CWorkTicketID%2CBranchName%2CWorkTicketStatusName%2CScheduledStartDate&%24filter=WorkTicketStatusName%20eq%20%27Open%27`;
|
||||
const headers = {
|
||||
'Authorization': `Bearer ${ASPIRE_TOKEN}`,
|
||||
@ -38,8 +39,7 @@ const seedDB = async () => {
|
||||
|
||||
//save to database before going to client
|
||||
// therefore logic to have databse filter logic beofre going to client
|
||||
// await worktickets.save();
|
||||
// Save each work ticket to the database
|
||||
|
||||
for (const workticket of workticketArray) {
|
||||
const ticket = new WorkTickets({
|
||||
WorkTicketID: workticket.WorkTicketID,
|
||||
|
@ -27,6 +27,7 @@ await WorkTicketVisits.deleteMany({});
|
||||
|
||||
try {
|
||||
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env;
|
||||
//Route pullung specific data points from ASPIRE API
|
||||
const apiUrl = `https://cloud-api.youraspire.com/WorkTicketVisits?%24select=WorkTicketVisitID%2CWorkTicketID%2CRouteName%2CScheduledDate&%24filter=ScheduledDate%20gt%202024-01-29`;
|
||||
const headers = {
|
||||
'Authorization': `Bearer ${ASPIRE_TOKEN}`,
|
||||
@ -38,8 +39,7 @@ await WorkTicketVisits.deleteMany({});
|
||||
|
||||
//save to database before going to client
|
||||
// therefore logic to have databse filter logic beofre going to client
|
||||
// await workticketvisits.save();
|
||||
// Save each work ticket visit to the database
|
||||
|
||||
for (const workticketvisit of workticketvisitsArray) {
|
||||
const visit = new WorkTicketVisits({
|
||||
WorkTicketVisitID: workticketvisit.WorkTicketVisitID,
|
Loading…
Reference in New Issue
Block a user