Comments Added

This commit is contained in:
Landry 2024-02-02 16:55:28 -08:00
parent df880c2f4c
commit 00aeae2b04
6 changed files with 13 additions and 12 deletions

View File

@ -27,6 +27,7 @@ const seedDB = async () => {
try { try {
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env; 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 apiUrl = `https://cloud-api.youraspire.com/Contacts?%24select=ContactID%2CCompanyName%2CContactTypeName%2CFirstName%2CLastName%2CEmail%2CMobilePhone`;
const headers = { const headers = {
'Authorization': `Bearer ${ASPIRE_TOKEN}`, 'Authorization': `Bearer ${ASPIRE_TOKEN}`,
@ -38,8 +39,7 @@ const seedDB = async () => {
//save to database before going to client //save to database before going to client
// therefore logic to have databse filter logic beofre 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) { for (const contactPerson of contactArray) {
const contact = new Contact({ const contact = new Contact({
ContactID: contactPerson.ContactID, ContactID: contactPerson.ContactID,

View File

@ -27,6 +27,7 @@ const seedDB = async () => {
try { try {
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env; 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 apiUrl = `https://cloud-api.youraspire.com/Opportunities?%24select=OpportunityID%2CPropertyID%2COpportunityStatusName%2CBranchName&%24filter=OpportunityStatusName%20eq%20%27won%27`;
const headers = { const headers = {
'Authorization': `Bearer ${ASPIRE_TOKEN}`, 'Authorization': `Bearer ${ASPIRE_TOKEN}`,
@ -38,8 +39,8 @@ const seedDB = async () => {
//save to database before going to client //save to database before going to client
// therefore logic to have databse filter logic beofre 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) { for (const wonOpportunity of opportunityArray) {
const opportunity = new Opportunity({ const opportunity = new Opportunity({
OpportunityID: wonOpportunity.OpportunityID, OpportunityID: wonOpportunity.OpportunityID,

View File

@ -26,6 +26,7 @@ const seedDB = async () => {
try { try {
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env; 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 apiUrl = `https://cloud-api.youraspire.com/Properties?%24select=PropertyID%2CBranchName%2CPropertyStatusName%2CPropertyAddressLine1%2CPropertyAddressLine2%2CPropertyAddressCity%2CPropertyAddressStateProvinceCode%2CPropertyAddressZipCode`;
const headers = { const headers = {
'Authorization': `Bearer ${ASPIRE_TOKEN}`, 'Authorization': `Bearer ${ASPIRE_TOKEN}`,
@ -37,8 +38,7 @@ const seedDB = async () => {
//save to database before going to client //save to database before going to client
// therefore logic to have databse filter logic beofre 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) { for (const propertyData of propertyArray) {
const property = new Property({ const property = new Property({
PropertyID: propertyData.PropertyID, PropertyID: propertyData.PropertyID,

View File

@ -26,6 +26,7 @@ const seedDB = async () => {
try { try {
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env; 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 apiUrl = `https://cloud-api.youraspire.com/PropertyContacts?%24select=PropertyID%2CContactID%2CContactName%2CCompanyName`;
const headers = { const headers = {
'Authorization': `Bearer ${ASPIRE_TOKEN}`, 'Authorization': `Bearer ${ASPIRE_TOKEN}`,
@ -37,8 +38,7 @@ const seedDB = async () => {
//save to database before going to client //save to database before going to client
// therefore logic to have databse filter logic beofre 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) { for (const propertyContactData of propertyArray) {
const property = new PropertyContact({ const property = new PropertyContact({
PropertyID: propertyContactData.PropertyID, PropertyID: propertyContactData.PropertyID,

View File

@ -27,6 +27,7 @@ const seedDB = async () => {
try { try {
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN, ASPIRE_REFRESH_TOKEN } = process.env; 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 apiUrl = `https://cloud-api.youraspire.com/WorkTickets?%24select=OpportunityID%2CPrice%2CWorkTicketID%2CBranchName%2CWorkTicketStatusName%2CScheduledStartDate&%24filter=WorkTicketStatusName%20eq%20%27Open%27`;
const headers = { const headers = {
'Authorization': `Bearer ${ASPIRE_TOKEN}`, 'Authorization': `Bearer ${ASPIRE_TOKEN}`,
@ -38,8 +39,7 @@ const seedDB = async () => {
//save to database before going to client //save to database before going to client
// therefore logic to have databse filter logic beofre 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) { for (const workticket of workticketArray) {
const ticket = new WorkTickets({ const ticket = new WorkTickets({
WorkTicketID: workticket.WorkTicketID, WorkTicketID: workticket.WorkTicketID,

View File

@ -27,6 +27,7 @@ await WorkTicketVisits.deleteMany({});
try { try {
const { ASPIRE_API_CLIENT_ID, ASPIRE_TOKEN } = process.env; 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 apiUrl = `https://cloud-api.youraspire.com/WorkTicketVisits?%24select=WorkTicketVisitID%2CWorkTicketID%2CRouteName%2CScheduledDate&%24filter=ScheduledDate%20gt%202024-01-29`;
const headers = { const headers = {
'Authorization': `Bearer ${ASPIRE_TOKEN}`, 'Authorization': `Bearer ${ASPIRE_TOKEN}`,
@ -38,8 +39,7 @@ await WorkTicketVisits.deleteMany({});
//save to database before going to client //save to database before going to client
// therefore logic to have databse filter logic beofre 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) { for (const workticketvisit of workticketvisitsArray) {
const visit = new WorkTicketVisits({ const visit = new WorkTicketVisits({
WorkTicketVisitID: workticketvisit.WorkTicketVisitID, WorkTicketVisitID: workticketvisit.WorkTicketVisitID,