10971 lines
237 KiB
JavaScript
10971 lines
237 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Organizations = db.organizations;
|
|
|
|
const Companies = db.companies;
|
|
|
|
const Customers = db.customers;
|
|
|
|
const Sites = db.sites;
|
|
|
|
const Projects = db.projects;
|
|
|
|
const SiteVisits = db.site_visits;
|
|
|
|
const PhotoInspections = db.photo_inspections;
|
|
|
|
const Products = db.products;
|
|
|
|
const Quotes = db.quotes;
|
|
|
|
const QuoteItems = db.quote_items;
|
|
|
|
const Signatures = db.signatures;
|
|
|
|
const MaterialLists = db.material_lists;
|
|
|
|
const MaterialListItems = db.material_list_items;
|
|
|
|
const PurchaseOrders = db.purchase_orders;
|
|
|
|
const PurchaseOrderItems = db.purchase_order_items;
|
|
|
|
const Tasks = db.tasks;
|
|
|
|
const Notifications = db.notifications;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const OrganizationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CompaniesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "HeatPro GmbH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"trade": "Wärmepumpen-Installation",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vat_number": "DE329001234",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "office@heatpro.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 30 1234560",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "https://heatpro.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Friedrichstrasse 120",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "3. OG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "10117",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Berlin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "DE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"logo_url": "https://cdn.example/heatpro/logo.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_currency": "EUR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pdf_footer_note": "Vielen Dank fuer Ihre Anfrage. Es gelten unsere AGB.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "SolarSpark Handwerk UG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"trade": "Solartechnik",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vat_number": "DE313445566",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "kontakt@solarspark.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 40 7788990",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "https://solarspark.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Alsterufer 22",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "20354",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Hamburg",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "DE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"logo_url": "https://cdn.example/solarspark/logo.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_currency": "EUR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pdf_footer_note": "Angebote sind 14 Tage gueltig.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "ElektroNord KG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"trade": "Elektroinstallation",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vat_number": "DE301112223",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "service@elektronord.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 511 2233440",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "https://elektronord.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Lister Meile 8",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "30161",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Hannover",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "DE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"logo_url": "https://cdn.example/elektronord/logo.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_currency": "EUR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pdf_footer_note": "Preise verstehen sich inkl. gesetzlicher MwSt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "BauKlar GmbH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"trade": "Sanierung",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vat_number": "DE300998877",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "info@bauklar.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 89 5566770",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "https://bauklar.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Leopoldstrasse 15",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "80802",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Muenchen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "DE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"logo_url": "https://cdn.example/bauklar/logo.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_currency": "EUR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pdf_footer_note": "Lieferzeiten koennen abweichen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Klimawerk Stuttgart GmbH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"trade": "Kälte-Klima",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"vat_number": "DE312009900",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "team@klimawerk.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 711 3344550",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website": "https://klimawerk.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Koenigstrasse 44",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "70173",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Stuttgart",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "DE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"logo_url": "https://cdn.example/klimawerk/logo.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_currency": "EUR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"default_tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"pdf_footer_note": "Bitte beachten Sie die Montagebedingungen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CustomersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_number": "C-10021",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_type": "business",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Familie Schubert",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_person": "Nina Schubert",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "nina.schubert@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 151 5550101",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line1": "Waldweg 7",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_postal_code": "14532",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_city": "Kleinmachnow",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_address_line1": "Waldweg 7",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_postal_code": "14532",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_city": "Kleinmachnow",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Bestandsgebaeude, Kellerzugang eng.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_number": "C-10022",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_type": "private",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Herr Tobias Meier",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_person": "Tobias Meier",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "t.meier@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 160 5550202",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line1": "Kastanienallee 19",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line2": "HH 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_postal_code": "10435",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_city": "Berlin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_address_line1": "Kastanienallee 19",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_postal_code": "10435",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_city": "Berlin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Waermepumpe im Hof geplant, Nachbarn informieren.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_number": "C-10023",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_type": "private",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Kita Sonnenschein e.V.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_person": "Sabine Krause",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "s.krause@kita-sonnenschein.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 30 5550303",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line1": "Goethestrasse 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_postal_code": "12629",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_city": "Berlin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_address_line1": "Goethestrasse 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_postal_code": "12629",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_city": "Berlin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Montage nur ausserhalb Ruhezeiten.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_number": "C-20011",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_type": "business",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Herr Pascal Lehmann",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_person": "Pascal Lehmann",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "p.lehmann@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 175 5550404",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line1": "Elbchaussee 88",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_postal_code": "22763",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_city": "Hamburg",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_address_line1": "Elbchaussee 88",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_postal_code": "22763",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_city": "Hamburg",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Dachzugang ueber innenliegende Treppe.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_number": "C-30007",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_type": "business",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Autohaus Bergmann GmbH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"contact_person": "Kai Bergmann",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"email": "kai.bergmann@autohaus-bergmann.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"phone": "+49 511 5550505",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line1": "Vahrenwalder Strasse 210",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_postal_code": "30165",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"service_city": "Hannover",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_address_line1": "Vahrenwalder Strasse 210",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_postal_code": "30165",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_city": "Hannover",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Hauptverteiler im Technikraum hinten links.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SitesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Schubert EFH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Waldweg 7",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "14532",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Kleinmachnow",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"access_notes": "Tor links, Klingel am Briefkasten.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Meier Altbau",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Kastanienallee 19",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "HH 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "10435",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Berlin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"access_notes": "Innenhof ueber Durchgang, niedrige Decke.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Kita Hauptgebaeude",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Goethestrasse 2",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "12629",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Berlin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"access_notes": "Anmeldung im Buero, Zugang zum Hof ueber Seitentor.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Lehmann Villa",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Elbchaussee 88",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "22763",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Hamburg",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"access_notes": "Parken nur an der Strasse, kurze Zuwegung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Autohaus Technik",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Vahrenwalder Strasse 210",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "30165",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Hannover",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"access_notes": "Technikraum nur mit Hausmeister.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProjectsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"project_number": "P-2026-0012",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Waermepumpe Austausch Schubert",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stage": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "urgent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-29T10:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_from": new Date('2026-03-10T07:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_to": new Date('2026-03-14T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Austausch Gastherme gegen Luft-Wasser-Waermepumpe, inkl. Hydraulikabgleich.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"project_number": "P-2026-0013",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Waermepumpe Planung Meier",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stage": "lead",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-31T12:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_from": new Date('2026-03-17T07:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_to": new Date('2026-03-21T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Altbau, geringe Stellflaeche im Hof, Schallschutz pruefen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"project_number": "P-2026-0014",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Kita Sonnenschein Heizungsmodernisierung",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stage": "site_visit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-02-01T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_from": new Date('2026-04-07T07:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_to": new Date('2026-04-18T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Ausschreibung vorbereiten, Foerderfaehigkeit und Zeitfenster abstimmen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"project_number": "P-2026-0041",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "PV Erweiterung Lehmann",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stage": "installation",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "urgent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-25T14:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_from": new Date('2026-02-24T07:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_to": new Date('2026-02-28T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Zusatzmodule und Speicher, Anschluss an bestehende Anlage.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"project_number": "P-2026-0070",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "E-Installation Autohaus Bergmann",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stage": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-01-20T08:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_from": new Date('2026-02-10T07:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_installation_to": new Date('2026-02-14T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Unterverteilung erweitern, Ladepunkte vorbereiten, Dokumentation erstellen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SiteVisitsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "confirmed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start": new Date('2026-02-07T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end": new Date('2026-02-07T09:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_in_at": new Date('2026-02-07T08:03:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_out_at": new Date('2026-02-07T09:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Heizraum im Keller, Abgasfuehrung vorhanden, Platz fuer Speicher knapp.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start": new Date('2026-02-08T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end": new Date('2026-02-08T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_in_at": new Date('2026-02-08T10:01:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_out_at": new Date('2026-02-08T10:52:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Hofmessung fuer Aussengeraet, Nachbarwand nahe.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "confirmed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start": new Date('2026-02-12T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end": new Date('2026-02-12T14:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_in_at": new Date('2026-02-12T13:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_out_at": new Date('2026-02-12T14:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Terminfokus: Technikraum, Zaehler, Betriebszeiten der Kita.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start": new Date('2026-02-03T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end": new Date('2026-02-03T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_in_at": new Date('2026-02-03T09:02:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_out_at": new Date('2026-02-03T09:55:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Dachflaeche frei, Kabelweg ins EG vorhanden, Speicherplatz im HWR.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_start": new Date('2026-02-05T07:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_end": new Date('2026-02-05T08:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_in_at": new Date('2026-02-05T07:31:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"check_out_at": new Date('2026-02-05T08:12:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Hauptverteiler dokumentiert, Reserveplaetze gering, Lastgangdaten angefragt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PhotoInspectionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-02-07T08:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"caption": "Heizraum Uebersicht",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manual_notes": "Rohrleitungen alt, Absperrungen teilweise schwergängig.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_status": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_confidence": 0.86,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_summary": "Erkannt: Gastherme wandhaengend, Rohrnetz mit Vorlauf Ruecklauf, Platz fuer Speicher begrenzt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-02-07T08:25:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"caption": "Zaehler und Sicherungen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manual_notes": "Freier Platz im Verteiler, FI vorhanden.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_status": "processing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_confidence": 0.74,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_summary": "Erkannt: Unterverteilung mit freien Modulen, Beschriftung teilweise lesbar.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-02-08T10:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"caption": "Hof Stellflaeche",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manual_notes": "Schallschutz erforderlich, Mindestabstaende pruefen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_confidence": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_summary": "In Bearbeitung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-02-03T09:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"caption": "Dachflaeche und Ziegel",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manual_notes": "Ziegelzustand gut, Sparrenabstand ok.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_confidence": 0.91,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_summary": "Erkannt: geneigtes Dach, ausreichende Flaeche fuer PV, keine sichtbaren Verschattungen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-02-05T07:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"caption": "Hauptverteiler",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"manual_notes": "Reserveplaetze gering, Erweiterungsschrank moeglich.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_confidence": 0.12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ai_summary": "Analyse fehlgeschlagen, Bild zu dunkel.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "HP-DAI-08KW",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Luft-Wasser Waermepumpe 8 kW",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "material",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 8490.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "HeizTech Grosshandel",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_product_code": "HT-DAI-08",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Monoblock, inkl. Regelung, geeignet fuer EFH.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "HP-PUF-200L",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Pufferspeicher 200 L",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "equipment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 690.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "HeizTech Grosshandel",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_product_code": "HT-PUF-200",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Mit Daemmung, Anschluesse seitlich.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "HP-INST-PAKET",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Montagepauschale Waermepumpe",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "material",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Pausch",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 2800.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "Intern",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_product_code": "SVC-WP-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Installation, Inbetriebnahme, Einweisung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "PV-MOD-430",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "PV Modul 430 W",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "service",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 115.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "SolarSupply GmbH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_product_code": "SS-430",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Monokristallin, schwarz gerahmt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "EL-FI-40A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "FI Schutzschalter 40A 30mA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "service",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 68.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "ElektroGrosshandel Nord",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_product_code": "EGN-FI40",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Typ A, 4-polig.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QuotesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quote_number": "Q-2026-0101",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date('2026-02-02T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"valid_until": new Date('2026-02-16T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal": 11980.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_total": 2276.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 14256.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_terms": "50 Prozent bei Auftrag, 50 Prozent nach Inbetriebnahme.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scope_of_work": "Lieferung und Montage einer Luft-Wasser Waermepumpe inkl. Demontage Altgeraet, Hydraulikabgleich und Inbetriebnahme.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_signature": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quote_number": "Q-2026-0102",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date('2026-02-06T15:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"valid_until": new Date('2026-02-20T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_total": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_terms": "Zahlbar innerhalb von 10 Tagen nach Rechnungseingang.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scope_of_work": "Angebot in Vorbereitung, Positionen werden nach Vor-Ort-Termin finalisiert.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_signature": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quote_number": "Q-2026-0103",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date('2026-02-05T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"valid_until": new Date('2026-02-28T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal": 21500.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_total": 4085.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 25585.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_terms": "Abschlagszahlung nach Baufortschritt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scope_of_work": "Konzept und Modernisierung Heizungsanlage, Details nach Begehung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_signature": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quote_number": "Q-2026-0201",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "expired",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date('2026-01-28T11:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"valid_until": new Date('2026-02-11T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal": 6230.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_total": 1183.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 7413.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_terms": "Zahlung bei Abnahme.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scope_of_work": "PV Erweiterung inkl. Zusatzmodule, Wechselrichteranpassung und Anmeldung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_signature": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quote_number": "Q-2026-0301",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "accepted",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"issued_at": new Date('2026-01-26T08:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"valid_until": new Date('2026-02-09T23:59:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal": 9800.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_total": 1862.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 11662.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_terms": "Zahlbar innerhalb von 14 Tagen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scope_of_work": "Erweiterung Unterverteilung, Vorbereitung Ladepunkte, Messprotokolle und Dokumentation.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requires_signature": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const QuoteItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position_number": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Luft-Wasser Waermepumpe 8 kW",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Monoblockgeraet inkl. Regelung und Standardzubehoer.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 8490.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 8490.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "fixed_price",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position_number": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Pufferspeicher 200 L",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Pufferspeicher inkl. Anschlussset und Daemmung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 690.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 690.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "labor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position_number": 30,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Montagepauschale",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Demontage Altgeraet, Montage, Inbetriebnahme, Einweisung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Pausch",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 2800.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 2800.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "fixed_price",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position_number": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "PV Module 430 W",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Zusatzmodule inkl. Montagesystem.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 12.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 115.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 1380.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "labor",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position_number": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "FI Schutzschalter 40A",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Typ A, 4-polig, inkl. Einbau und Beschriftung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 4.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 68.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tax_rate": 0.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 272.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_type": "fixed_price",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SignaturesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_type": "company",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_name": "Nina Schubert",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_email": "nina.schubert@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signed_at": new Date('2026-02-03T18:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signature_hash": "9f2c4b1d6a7e4f0a8d9c1b2a3c4d5e6f",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_type": "customer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_name": "Pascal Lehmann",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_email": "p.lehmann@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signed_at": new Date('2026-01-30T12:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signature_hash": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_type": "company",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_name": "Markus Weber",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_email": "markus.weber@heatpro.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signed_at": new Date('2026-01-30T12:25:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signature_hash": "b0c1d2e3f40516273849a5b6c7d8e9f0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_type": "customer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_name": "Tobias Meier",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_email": "t.meier@example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signed_at": new Date('2026-02-07T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signature_hash": "c9d8e7f60123456789abcdeffedcba98",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_type": "customer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_name": "Lena Hoffmann",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signer_email": "lena.hoffmann@heatpro.example",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signed_at": new Date('2026-01-26T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"signature_hash": "0f9e8d7c6b5a493827161504f3e2d1c0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MaterialListsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"needed_by": new Date('2026-03-07T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Material komplett vor Montagewoche anliefern.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "delivered",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"needed_by": new Date('2026-03-14T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Positionen nach finaler Auslegung ergaenzen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "ready",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"needed_by": new Date('2026-04-01T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Foerderkomponenten und Schallschutz pruefen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "ready",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"needed_by": new Date('2026-02-20T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Lieferung direkt zur Baustelle.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "ready",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"needed_by": new Date('2026-02-09T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Restlieferung FI und Automaten ausstehend.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const MaterialListItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"procurement_status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_unit_cost": 7900.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Lieferung mit Spedition, Anlieferavis erforderlich.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"procurement_status": "requested",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_unit_cost": 610.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Mit Anschlussset.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Pausch",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"procurement_status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_unit_cost": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Interne Leistung, nur zur Planung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 12.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"procurement_status": "planned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_unit_cost": 98.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Module bereits auf Lager eingetroffen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 4.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit": "Stk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"procurement_status": "backordered",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_unit_cost": 52.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Liefertermin beim Grosshandel angefragt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PurchaseOrdersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"po_number": "PO-2026-0008",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "HeizTech Grosshandel",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "partially_received",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-02-04T10:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_delivery_at": new Date('2026-02-20T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 8510.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Bitte Anlieferung vormittags und Avis per Mail.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"po_number": "PO-2026-0009",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "HeizTech Grosshandel",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "partially_received",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-02-06T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_delivery_at": new Date('2026-02-28T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Wird nach Auslegung final.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"po_number": "PO-2026-0103",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "SolarSupply GmbH",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "confirmed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-01-30T15:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_delivery_at": new Date('2026-02-05T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 1176.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Lieferung erfolgte fristgerecht.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"po_number": "PO-2026-0207",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "ElektroGrosshandel Nord",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "sent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-02-01T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_delivery_at": new Date('2026-02-08T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 420.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Teilmenge geliefert, Rest im Rueckstand.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"po_number": "PO-2026-0010",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"supplier_name": "HeizTech Grosshandel",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ordered_at": new Date('2026-02-05T11:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expected_delivery_at": new Date('2026-02-22T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total": 610.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Nur Pufferspeicher als Teillieferung.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PurchaseOrderItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_cost": 7900.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 7900.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_cost": 610.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 610.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 12.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_cost": 98.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 1176.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 4.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_cost": 52.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 208.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_cost": 610.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 610.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TasksData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Angebot an Kunde senden",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"task_type": "request_material",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-02-02T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-02-02T10:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "PDF versendet, Rueckfragen erwartet.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Materialliste finalisieren",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"task_type": "installation",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-02-10T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-02-10T15:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Pufferspeicher und Montagezubehoer bestaetigen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Vor-Ort Termin dokumentieren",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "todo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"task_type": "request_material",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-02-08T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-02-08T17:50:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Fotos und Messwerte in Projekt hinterlegen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Auftrag bestaetigen und Bestellung ausloesen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"task_type": "request_material",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-01-31T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-01-30T15:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "PO erstellt, Liefertermin abgestimmt.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Kundenfreigabe fuer Installationsfenster einholen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"task_type": "installation",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-02-07T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-02-07T11:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Rueckruf erbeten, Ansprechpartner im Autohaus nicht erreichbar.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const NotificationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"channel": "in_app",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "material_list_ready",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Angebot Q-2026-0101 gesendet",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Das Angebot wurde an Familie Schubert versendet.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sent_at": new Date('2026-02-02T10:06:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read_at": new Date('2026-02-02T10:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"channel": "sms",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "purchase_order_confirmed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Angebot Q-2026-0201 angenommen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Der Kunde Pascal Lehmann hat das Angebot angenommen.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sent_at": new Date('2026-01-30T12:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read_at": new Date('2026-01-30T13:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"channel": "email",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "quote_sent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Termin Erinnerung",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Begehung fuer Projekt Waermepumpe Austausch Schubert startet um 08:00.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sent_at": new Date('2026-02-07T07:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read_at": new Date('2026-02-07T07:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"channel": "email",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "purchase_order_confirmed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Neue Aufgabe zugewiesen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Bitte dokumentiere den Vor-Ort Termin im Projekt Waermepumpe Planung Meier.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sent_at": new Date('2026-02-08T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read_at": new Date('2026-02-08T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"channel": "sms",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "task_assigned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Bestellung PO-2026-0008 bestaetigt",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "HeizTech Grosshandel hat die Bestellung bestaetigt, erwartete Lieferung 20.02.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sent_at": new Date('2026-02-04T11:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"read_at": new Date('2026-02-04T11:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
async function associateUserWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User0 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (User0?.setOrganization)
|
|
{
|
|
await
|
|
User0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User1 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (User1?.setOrganization)
|
|
{
|
|
await
|
|
User1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User2 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (User2?.setOrganization)
|
|
{
|
|
await
|
|
User2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User3 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (User3?.setOrganization)
|
|
{
|
|
await
|
|
User3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User4 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (User4?.setOrganization)
|
|
{
|
|
await
|
|
User4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCompanyWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company0 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Company0?.setOrganization)
|
|
{
|
|
await
|
|
Company0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company1 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Company1?.setOrganization)
|
|
{
|
|
await
|
|
Company1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company2 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Company2?.setOrganization)
|
|
{
|
|
await
|
|
Company2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company3 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Company3?.setOrganization)
|
|
{
|
|
await
|
|
Company3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Company4 = await Companies.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Company4?.setOrganization)
|
|
{
|
|
await
|
|
Company4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCustomerWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer0 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Customer0?.setCompany)
|
|
{
|
|
await
|
|
Customer0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer1 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Customer1?.setCompany)
|
|
{
|
|
await
|
|
Customer1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer2 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Customer2?.setCompany)
|
|
{
|
|
await
|
|
Customer2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer3 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Customer3?.setCompany)
|
|
{
|
|
await
|
|
Customer3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
const relatedCompany4 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Customer4 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Customer4?.setCompany)
|
|
{
|
|
await
|
|
Customer4.
|
|
setCompany(relatedCompany4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCustomerWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer0 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Customer0?.setOrganization)
|
|
{
|
|
await
|
|
Customer0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer1 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Customer1?.setOrganization)
|
|
{
|
|
await
|
|
Customer1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer2 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Customer2?.setOrganization)
|
|
{
|
|
await
|
|
Customer2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer3 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Customer3?.setOrganization)
|
|
{
|
|
await
|
|
Customer3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Customer4 = await Customers.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Customer4?.setOrganization)
|
|
{
|
|
await
|
|
Customer4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSiteWithCustomer() {
|
|
|
|
const relatedCustomer0 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Site0 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Site0?.setCustomer)
|
|
{
|
|
await
|
|
Site0.
|
|
setCustomer(relatedCustomer0);
|
|
}
|
|
|
|
const relatedCustomer1 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Site1 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Site1?.setCustomer)
|
|
{
|
|
await
|
|
Site1.
|
|
setCustomer(relatedCustomer1);
|
|
}
|
|
|
|
const relatedCustomer2 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Site2 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Site2?.setCustomer)
|
|
{
|
|
await
|
|
Site2.
|
|
setCustomer(relatedCustomer2);
|
|
}
|
|
|
|
const relatedCustomer3 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Site3 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Site3?.setCustomer)
|
|
{
|
|
await
|
|
Site3.
|
|
setCustomer(relatedCustomer3);
|
|
}
|
|
|
|
const relatedCustomer4 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Site4 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Site4?.setCustomer)
|
|
{
|
|
await
|
|
Site4.
|
|
setCustomer(relatedCustomer4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSiteWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Site0 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Site0?.setOrganization)
|
|
{
|
|
await
|
|
Site0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Site1 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Site1?.setOrganization)
|
|
{
|
|
await
|
|
Site1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Site2 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Site2?.setOrganization)
|
|
{
|
|
await
|
|
Site2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Site3 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Site3?.setOrganization)
|
|
{
|
|
await
|
|
Site3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Site4 = await Sites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Site4?.setOrganization)
|
|
{
|
|
await
|
|
Site4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProjectWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Project0 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Project0?.setCompany)
|
|
{
|
|
await
|
|
Project0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Project1 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Project1?.setCompany)
|
|
{
|
|
await
|
|
Project1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Project2 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Project2?.setCompany)
|
|
{
|
|
await
|
|
Project2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Project3 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Project3?.setCompany)
|
|
{
|
|
await
|
|
Project3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
const relatedCompany4 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Project4 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Project4?.setCompany)
|
|
{
|
|
await
|
|
Project4.
|
|
setCompany(relatedCompany4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProjectWithCustomer() {
|
|
|
|
const relatedCustomer0 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Project0 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Project0?.setCustomer)
|
|
{
|
|
await
|
|
Project0.
|
|
setCustomer(relatedCustomer0);
|
|
}
|
|
|
|
const relatedCustomer1 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Project1 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Project1?.setCustomer)
|
|
{
|
|
await
|
|
Project1.
|
|
setCustomer(relatedCustomer1);
|
|
}
|
|
|
|
const relatedCustomer2 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Project2 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Project2?.setCustomer)
|
|
{
|
|
await
|
|
Project2.
|
|
setCustomer(relatedCustomer2);
|
|
}
|
|
|
|
const relatedCustomer3 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Project3 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Project3?.setCustomer)
|
|
{
|
|
await
|
|
Project3.
|
|
setCustomer(relatedCustomer3);
|
|
}
|
|
|
|
const relatedCustomer4 = await Customers.findOne({
|
|
offset: Math.floor(Math.random() * (await Customers.count())),
|
|
});
|
|
const Project4 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Project4?.setCustomer)
|
|
{
|
|
await
|
|
Project4.
|
|
setCustomer(relatedCustomer4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProjectWithSite() {
|
|
|
|
const relatedSite0 = await Sites.findOne({
|
|
offset: Math.floor(Math.random() * (await Sites.count())),
|
|
});
|
|
const Project0 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Project0?.setSite)
|
|
{
|
|
await
|
|
Project0.
|
|
setSite(relatedSite0);
|
|
}
|
|
|
|
const relatedSite1 = await Sites.findOne({
|
|
offset: Math.floor(Math.random() * (await Sites.count())),
|
|
});
|
|
const Project1 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Project1?.setSite)
|
|
{
|
|
await
|
|
Project1.
|
|
setSite(relatedSite1);
|
|
}
|
|
|
|
const relatedSite2 = await Sites.findOne({
|
|
offset: Math.floor(Math.random() * (await Sites.count())),
|
|
});
|
|
const Project2 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Project2?.setSite)
|
|
{
|
|
await
|
|
Project2.
|
|
setSite(relatedSite2);
|
|
}
|
|
|
|
const relatedSite3 = await Sites.findOne({
|
|
offset: Math.floor(Math.random() * (await Sites.count())),
|
|
});
|
|
const Project3 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Project3?.setSite)
|
|
{
|
|
await
|
|
Project3.
|
|
setSite(relatedSite3);
|
|
}
|
|
|
|
const relatedSite4 = await Sites.findOne({
|
|
offset: Math.floor(Math.random() * (await Sites.count())),
|
|
});
|
|
const Project4 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Project4?.setSite)
|
|
{
|
|
await
|
|
Project4.
|
|
setSite(relatedSite4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProjectWithAssigned_to() {
|
|
|
|
const relatedAssigned_to0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Project0 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Project0?.setAssigned_to)
|
|
{
|
|
await
|
|
Project0.
|
|
setAssigned_to(relatedAssigned_to0);
|
|
}
|
|
|
|
const relatedAssigned_to1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Project1 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Project1?.setAssigned_to)
|
|
{
|
|
await
|
|
Project1.
|
|
setAssigned_to(relatedAssigned_to1);
|
|
}
|
|
|
|
const relatedAssigned_to2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Project2 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Project2?.setAssigned_to)
|
|
{
|
|
await
|
|
Project2.
|
|
setAssigned_to(relatedAssigned_to2);
|
|
}
|
|
|
|
const relatedAssigned_to3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Project3 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Project3?.setAssigned_to)
|
|
{
|
|
await
|
|
Project3.
|
|
setAssigned_to(relatedAssigned_to3);
|
|
}
|
|
|
|
const relatedAssigned_to4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Project4 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Project4?.setAssigned_to)
|
|
{
|
|
await
|
|
Project4.
|
|
setAssigned_to(relatedAssigned_to4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProjectWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project0 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Project0?.setOrganization)
|
|
{
|
|
await
|
|
Project0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project1 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Project1?.setOrganization)
|
|
{
|
|
await
|
|
Project1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project2 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Project2?.setOrganization)
|
|
{
|
|
await
|
|
Project2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project3 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Project3?.setOrganization)
|
|
{
|
|
await
|
|
Project3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project4 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Project4?.setOrganization)
|
|
{
|
|
await
|
|
Project4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSiteVisitWithProject() {
|
|
|
|
const relatedProject0 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const SiteVisit0 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SiteVisit0?.setProject)
|
|
{
|
|
await
|
|
SiteVisit0.
|
|
setProject(relatedProject0);
|
|
}
|
|
|
|
const relatedProject1 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const SiteVisit1 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SiteVisit1?.setProject)
|
|
{
|
|
await
|
|
SiteVisit1.
|
|
setProject(relatedProject1);
|
|
}
|
|
|
|
const relatedProject2 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const SiteVisit2 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SiteVisit2?.setProject)
|
|
{
|
|
await
|
|
SiteVisit2.
|
|
setProject(relatedProject2);
|
|
}
|
|
|
|
const relatedProject3 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const SiteVisit3 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (SiteVisit3?.setProject)
|
|
{
|
|
await
|
|
SiteVisit3.
|
|
setProject(relatedProject3);
|
|
}
|
|
|
|
const relatedProject4 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const SiteVisit4 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (SiteVisit4?.setProject)
|
|
{
|
|
await
|
|
SiteVisit4.
|
|
setProject(relatedProject4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateSiteVisitWithTechnician() {
|
|
|
|
const relatedTechnician0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SiteVisit0 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SiteVisit0?.setTechnician)
|
|
{
|
|
await
|
|
SiteVisit0.
|
|
setTechnician(relatedTechnician0);
|
|
}
|
|
|
|
const relatedTechnician1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SiteVisit1 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SiteVisit1?.setTechnician)
|
|
{
|
|
await
|
|
SiteVisit1.
|
|
setTechnician(relatedTechnician1);
|
|
}
|
|
|
|
const relatedTechnician2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SiteVisit2 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SiteVisit2?.setTechnician)
|
|
{
|
|
await
|
|
SiteVisit2.
|
|
setTechnician(relatedTechnician2);
|
|
}
|
|
|
|
const relatedTechnician3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SiteVisit3 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (SiteVisit3?.setTechnician)
|
|
{
|
|
await
|
|
SiteVisit3.
|
|
setTechnician(relatedTechnician3);
|
|
}
|
|
|
|
const relatedTechnician4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SiteVisit4 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (SiteVisit4?.setTechnician)
|
|
{
|
|
await
|
|
SiteVisit4.
|
|
setTechnician(relatedTechnician4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSiteVisitWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const SiteVisit0 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SiteVisit0?.setOrganization)
|
|
{
|
|
await
|
|
SiteVisit0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const SiteVisit1 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SiteVisit1?.setOrganization)
|
|
{
|
|
await
|
|
SiteVisit1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const SiteVisit2 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SiteVisit2?.setOrganization)
|
|
{
|
|
await
|
|
SiteVisit2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const SiteVisit3 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (SiteVisit3?.setOrganization)
|
|
{
|
|
await
|
|
SiteVisit3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const SiteVisit4 = await SiteVisits.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (SiteVisit4?.setOrganization)
|
|
{
|
|
await
|
|
SiteVisit4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePhotoInspectionWithProject() {
|
|
|
|
const relatedProject0 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const PhotoInspection0 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PhotoInspection0?.setProject)
|
|
{
|
|
await
|
|
PhotoInspection0.
|
|
setProject(relatedProject0);
|
|
}
|
|
|
|
const relatedProject1 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const PhotoInspection1 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PhotoInspection1?.setProject)
|
|
{
|
|
await
|
|
PhotoInspection1.
|
|
setProject(relatedProject1);
|
|
}
|
|
|
|
const relatedProject2 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const PhotoInspection2 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PhotoInspection2?.setProject)
|
|
{
|
|
await
|
|
PhotoInspection2.
|
|
setProject(relatedProject2);
|
|
}
|
|
|
|
const relatedProject3 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const PhotoInspection3 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PhotoInspection3?.setProject)
|
|
{
|
|
await
|
|
PhotoInspection3.
|
|
setProject(relatedProject3);
|
|
}
|
|
|
|
const relatedProject4 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const PhotoInspection4 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PhotoInspection4?.setProject)
|
|
{
|
|
await
|
|
PhotoInspection4.
|
|
setProject(relatedProject4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associatePhotoInspectionWithCaptured_by() {
|
|
|
|
const relatedCaptured_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PhotoInspection0 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PhotoInspection0?.setCaptured_by)
|
|
{
|
|
await
|
|
PhotoInspection0.
|
|
setCaptured_by(relatedCaptured_by0);
|
|
}
|
|
|
|
const relatedCaptured_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PhotoInspection1 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PhotoInspection1?.setCaptured_by)
|
|
{
|
|
await
|
|
PhotoInspection1.
|
|
setCaptured_by(relatedCaptured_by1);
|
|
}
|
|
|
|
const relatedCaptured_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PhotoInspection2 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PhotoInspection2?.setCaptured_by)
|
|
{
|
|
await
|
|
PhotoInspection2.
|
|
setCaptured_by(relatedCaptured_by2);
|
|
}
|
|
|
|
const relatedCaptured_by3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PhotoInspection3 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PhotoInspection3?.setCaptured_by)
|
|
{
|
|
await
|
|
PhotoInspection3.
|
|
setCaptured_by(relatedCaptured_by3);
|
|
}
|
|
|
|
const relatedCaptured_by4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const PhotoInspection4 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PhotoInspection4?.setCaptured_by)
|
|
{
|
|
await
|
|
PhotoInspection4.
|
|
setCaptured_by(relatedCaptured_by4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePhotoInspectionWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PhotoInspection0 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PhotoInspection0?.setOrganization)
|
|
{
|
|
await
|
|
PhotoInspection0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PhotoInspection1 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PhotoInspection1?.setOrganization)
|
|
{
|
|
await
|
|
PhotoInspection1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PhotoInspection2 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PhotoInspection2?.setOrganization)
|
|
{
|
|
await
|
|
PhotoInspection2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PhotoInspection3 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PhotoInspection3?.setOrganization)
|
|
{
|
|
await
|
|
PhotoInspection3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PhotoInspection4 = await PhotoInspections.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PhotoInspection4?.setOrganization)
|
|
{
|
|
await
|
|
PhotoInspection4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Product0 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Product0?.setCompany)
|
|
{
|
|
await
|
|
Product0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Product1 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Product1?.setCompany)
|
|
{
|
|
await
|
|
Product1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Product2 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Product2?.setCompany)
|
|
{
|
|
await
|
|
Product2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Product3 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Product3?.setCompany)
|
|
{
|
|
await
|
|
Product3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
const relatedCompany4 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const Product4 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Product4?.setCompany)
|
|
{
|
|
await
|
|
Product4.
|
|
setCompany(relatedCompany4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Product0 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Product0?.setOrganization)
|
|
{
|
|
await
|
|
Product0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Product1 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Product1?.setOrganization)
|
|
{
|
|
await
|
|
Product1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Product2 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Product2?.setOrganization)
|
|
{
|
|
await
|
|
Product2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Product3 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Product3?.setOrganization)
|
|
{
|
|
await
|
|
Product3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Product4 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Product4?.setOrganization)
|
|
{
|
|
await
|
|
Product4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQuoteWithProject() {
|
|
|
|
const relatedProject0 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Quote0 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Quote0?.setProject)
|
|
{
|
|
await
|
|
Quote0.
|
|
setProject(relatedProject0);
|
|
}
|
|
|
|
const relatedProject1 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Quote1 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Quote1?.setProject)
|
|
{
|
|
await
|
|
Quote1.
|
|
setProject(relatedProject1);
|
|
}
|
|
|
|
const relatedProject2 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Quote2 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Quote2?.setProject)
|
|
{
|
|
await
|
|
Quote2.
|
|
setProject(relatedProject2);
|
|
}
|
|
|
|
const relatedProject3 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Quote3 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Quote3?.setProject)
|
|
{
|
|
await
|
|
Quote3.
|
|
setProject(relatedProject3);
|
|
}
|
|
|
|
const relatedProject4 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Quote4 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Quote4?.setProject)
|
|
{
|
|
await
|
|
Quote4.
|
|
setProject(relatedProject4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQuoteWithPrepared_by() {
|
|
|
|
const relatedPrepared_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Quote0 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Quote0?.setPrepared_by)
|
|
{
|
|
await
|
|
Quote0.
|
|
setPrepared_by(relatedPrepared_by0);
|
|
}
|
|
|
|
const relatedPrepared_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Quote1 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Quote1?.setPrepared_by)
|
|
{
|
|
await
|
|
Quote1.
|
|
setPrepared_by(relatedPrepared_by1);
|
|
}
|
|
|
|
const relatedPrepared_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Quote2 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Quote2?.setPrepared_by)
|
|
{
|
|
await
|
|
Quote2.
|
|
setPrepared_by(relatedPrepared_by2);
|
|
}
|
|
|
|
const relatedPrepared_by3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Quote3 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Quote3?.setPrepared_by)
|
|
{
|
|
await
|
|
Quote3.
|
|
setPrepared_by(relatedPrepared_by3);
|
|
}
|
|
|
|
const relatedPrepared_by4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Quote4 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Quote4?.setPrepared_by)
|
|
{
|
|
await
|
|
Quote4.
|
|
setPrepared_by(relatedPrepared_by4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQuoteWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Quote0 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Quote0?.setOrganization)
|
|
{
|
|
await
|
|
Quote0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Quote1 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Quote1?.setOrganization)
|
|
{
|
|
await
|
|
Quote1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Quote2 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Quote2?.setOrganization)
|
|
{
|
|
await
|
|
Quote2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Quote3 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Quote3?.setOrganization)
|
|
{
|
|
await
|
|
Quote3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Quote4 = await Quotes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Quote4?.setOrganization)
|
|
{
|
|
await
|
|
Quote4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQuoteItemWithQuote() {
|
|
|
|
const relatedQuote0 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const QuoteItem0 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QuoteItem0?.setQuote)
|
|
{
|
|
await
|
|
QuoteItem0.
|
|
setQuote(relatedQuote0);
|
|
}
|
|
|
|
const relatedQuote1 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const QuoteItem1 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QuoteItem1?.setQuote)
|
|
{
|
|
await
|
|
QuoteItem1.
|
|
setQuote(relatedQuote1);
|
|
}
|
|
|
|
const relatedQuote2 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const QuoteItem2 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QuoteItem2?.setQuote)
|
|
{
|
|
await
|
|
QuoteItem2.
|
|
setQuote(relatedQuote2);
|
|
}
|
|
|
|
const relatedQuote3 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const QuoteItem3 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QuoteItem3?.setQuote)
|
|
{
|
|
await
|
|
QuoteItem3.
|
|
setQuote(relatedQuote3);
|
|
}
|
|
|
|
const relatedQuote4 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const QuoteItem4 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QuoteItem4?.setQuote)
|
|
{
|
|
await
|
|
QuoteItem4.
|
|
setQuote(relatedQuote4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateQuoteItemWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const QuoteItem0 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QuoteItem0?.setProduct)
|
|
{
|
|
await
|
|
QuoteItem0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const QuoteItem1 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QuoteItem1?.setProduct)
|
|
{
|
|
await
|
|
QuoteItem1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const QuoteItem2 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QuoteItem2?.setProduct)
|
|
{
|
|
await
|
|
QuoteItem2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
const relatedProduct3 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const QuoteItem3 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QuoteItem3?.setProduct)
|
|
{
|
|
await
|
|
QuoteItem3.
|
|
setProduct(relatedProduct3);
|
|
}
|
|
|
|
const relatedProduct4 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const QuoteItem4 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QuoteItem4?.setProduct)
|
|
{
|
|
await
|
|
QuoteItem4.
|
|
setProduct(relatedProduct4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateQuoteItemWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QuoteItem0 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (QuoteItem0?.setOrganization)
|
|
{
|
|
await
|
|
QuoteItem0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QuoteItem1 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (QuoteItem1?.setOrganization)
|
|
{
|
|
await
|
|
QuoteItem1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QuoteItem2 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (QuoteItem2?.setOrganization)
|
|
{
|
|
await
|
|
QuoteItem2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QuoteItem3 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (QuoteItem3?.setOrganization)
|
|
{
|
|
await
|
|
QuoteItem3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const QuoteItem4 = await QuoteItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (QuoteItem4?.setOrganization)
|
|
{
|
|
await
|
|
QuoteItem4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSignatureWithQuote() {
|
|
|
|
const relatedQuote0 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const Signature0 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Signature0?.setQuote)
|
|
{
|
|
await
|
|
Signature0.
|
|
setQuote(relatedQuote0);
|
|
}
|
|
|
|
const relatedQuote1 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const Signature1 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Signature1?.setQuote)
|
|
{
|
|
await
|
|
Signature1.
|
|
setQuote(relatedQuote1);
|
|
}
|
|
|
|
const relatedQuote2 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const Signature2 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Signature2?.setQuote)
|
|
{
|
|
await
|
|
Signature2.
|
|
setQuote(relatedQuote2);
|
|
}
|
|
|
|
const relatedQuote3 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const Signature3 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Signature3?.setQuote)
|
|
{
|
|
await
|
|
Signature3.
|
|
setQuote(relatedQuote3);
|
|
}
|
|
|
|
const relatedQuote4 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const Signature4 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Signature4?.setQuote)
|
|
{
|
|
await
|
|
Signature4.
|
|
setQuote(relatedQuote4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSignatureWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Signature0 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Signature0?.setOrganization)
|
|
{
|
|
await
|
|
Signature0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Signature1 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Signature1?.setOrganization)
|
|
{
|
|
await
|
|
Signature1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Signature2 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Signature2?.setOrganization)
|
|
{
|
|
await
|
|
Signature2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Signature3 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Signature3?.setOrganization)
|
|
{
|
|
await
|
|
Signature3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Signature4 = await Signatures.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Signature4?.setOrganization)
|
|
{
|
|
await
|
|
Signature4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialListWithProject() {
|
|
|
|
const relatedProject0 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const MaterialList0 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialList0?.setProject)
|
|
{
|
|
await
|
|
MaterialList0.
|
|
setProject(relatedProject0);
|
|
}
|
|
|
|
const relatedProject1 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const MaterialList1 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialList1?.setProject)
|
|
{
|
|
await
|
|
MaterialList1.
|
|
setProject(relatedProject1);
|
|
}
|
|
|
|
const relatedProject2 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const MaterialList2 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialList2?.setProject)
|
|
{
|
|
await
|
|
MaterialList2.
|
|
setProject(relatedProject2);
|
|
}
|
|
|
|
const relatedProject3 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const MaterialList3 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialList3?.setProject)
|
|
{
|
|
await
|
|
MaterialList3.
|
|
setProject(relatedProject3);
|
|
}
|
|
|
|
const relatedProject4 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const MaterialList4 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialList4?.setProject)
|
|
{
|
|
await
|
|
MaterialList4.
|
|
setProject(relatedProject4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMaterialListWithQuote() {
|
|
|
|
const relatedQuote0 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const MaterialList0 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialList0?.setQuote)
|
|
{
|
|
await
|
|
MaterialList0.
|
|
setQuote(relatedQuote0);
|
|
}
|
|
|
|
const relatedQuote1 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const MaterialList1 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialList1?.setQuote)
|
|
{
|
|
await
|
|
MaterialList1.
|
|
setQuote(relatedQuote1);
|
|
}
|
|
|
|
const relatedQuote2 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const MaterialList2 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialList2?.setQuote)
|
|
{
|
|
await
|
|
MaterialList2.
|
|
setQuote(relatedQuote2);
|
|
}
|
|
|
|
const relatedQuote3 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const MaterialList3 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialList3?.setQuote)
|
|
{
|
|
await
|
|
MaterialList3.
|
|
setQuote(relatedQuote3);
|
|
}
|
|
|
|
const relatedQuote4 = await Quotes.findOne({
|
|
offset: Math.floor(Math.random() * (await Quotes.count())),
|
|
});
|
|
const MaterialList4 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialList4?.setQuote)
|
|
{
|
|
await
|
|
MaterialList4.
|
|
setQuote(relatedQuote4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialListWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialList0 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialList0?.setOrganization)
|
|
{
|
|
await
|
|
MaterialList0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialList1 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialList1?.setOrganization)
|
|
{
|
|
await
|
|
MaterialList1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialList2 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialList2?.setOrganization)
|
|
{
|
|
await
|
|
MaterialList2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialList3 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialList3?.setOrganization)
|
|
{
|
|
await
|
|
MaterialList3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialList4 = await MaterialLists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialList4?.setOrganization)
|
|
{
|
|
await
|
|
MaterialList4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialListItemWithMaterial_list() {
|
|
|
|
const relatedMaterial_list0 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const MaterialListItem0 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialListItem0?.setMaterial_list)
|
|
{
|
|
await
|
|
MaterialListItem0.
|
|
setMaterial_list(relatedMaterial_list0);
|
|
}
|
|
|
|
const relatedMaterial_list1 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const MaterialListItem1 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialListItem1?.setMaterial_list)
|
|
{
|
|
await
|
|
MaterialListItem1.
|
|
setMaterial_list(relatedMaterial_list1);
|
|
}
|
|
|
|
const relatedMaterial_list2 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const MaterialListItem2 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialListItem2?.setMaterial_list)
|
|
{
|
|
await
|
|
MaterialListItem2.
|
|
setMaterial_list(relatedMaterial_list2);
|
|
}
|
|
|
|
const relatedMaterial_list3 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const MaterialListItem3 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialListItem3?.setMaterial_list)
|
|
{
|
|
await
|
|
MaterialListItem3.
|
|
setMaterial_list(relatedMaterial_list3);
|
|
}
|
|
|
|
const relatedMaterial_list4 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const MaterialListItem4 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialListItem4?.setMaterial_list)
|
|
{
|
|
await
|
|
MaterialListItem4.
|
|
setMaterial_list(relatedMaterial_list4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateMaterialListItemWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const MaterialListItem0 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialListItem0?.setProduct)
|
|
{
|
|
await
|
|
MaterialListItem0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const MaterialListItem1 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialListItem1?.setProduct)
|
|
{
|
|
await
|
|
MaterialListItem1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const MaterialListItem2 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialListItem2?.setProduct)
|
|
{
|
|
await
|
|
MaterialListItem2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
const relatedProduct3 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const MaterialListItem3 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialListItem3?.setProduct)
|
|
{
|
|
await
|
|
MaterialListItem3.
|
|
setProduct(relatedProduct3);
|
|
}
|
|
|
|
const relatedProduct4 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const MaterialListItem4 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialListItem4?.setProduct)
|
|
{
|
|
await
|
|
MaterialListItem4.
|
|
setProduct(relatedProduct4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateMaterialListItemWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialListItem0 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (MaterialListItem0?.setOrganization)
|
|
{
|
|
await
|
|
MaterialListItem0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialListItem1 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (MaterialListItem1?.setOrganization)
|
|
{
|
|
await
|
|
MaterialListItem1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialListItem2 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (MaterialListItem2?.setOrganization)
|
|
{
|
|
await
|
|
MaterialListItem2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialListItem3 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (MaterialListItem3?.setOrganization)
|
|
{
|
|
await
|
|
MaterialListItem3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const MaterialListItem4 = await MaterialListItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (MaterialListItem4?.setOrganization)
|
|
{
|
|
await
|
|
MaterialListItem4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderWithCompany() {
|
|
|
|
const relatedCompany0 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const PurchaseOrder0 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrder0?.setCompany)
|
|
{
|
|
await
|
|
PurchaseOrder0.
|
|
setCompany(relatedCompany0);
|
|
}
|
|
|
|
const relatedCompany1 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const PurchaseOrder1 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrder1?.setCompany)
|
|
{
|
|
await
|
|
PurchaseOrder1.
|
|
setCompany(relatedCompany1);
|
|
}
|
|
|
|
const relatedCompany2 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const PurchaseOrder2 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrder2?.setCompany)
|
|
{
|
|
await
|
|
PurchaseOrder2.
|
|
setCompany(relatedCompany2);
|
|
}
|
|
|
|
const relatedCompany3 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const PurchaseOrder3 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrder3?.setCompany)
|
|
{
|
|
await
|
|
PurchaseOrder3.
|
|
setCompany(relatedCompany3);
|
|
}
|
|
|
|
const relatedCompany4 = await Companies.findOne({
|
|
offset: Math.floor(Math.random() * (await Companies.count())),
|
|
});
|
|
const PurchaseOrder4 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrder4?.setCompany)
|
|
{
|
|
await
|
|
PurchaseOrder4.
|
|
setCompany(relatedCompany4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderWithMaterial_list() {
|
|
|
|
const relatedMaterial_list0 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const PurchaseOrder0 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrder0?.setMaterial_list)
|
|
{
|
|
await
|
|
PurchaseOrder0.
|
|
setMaterial_list(relatedMaterial_list0);
|
|
}
|
|
|
|
const relatedMaterial_list1 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const PurchaseOrder1 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrder1?.setMaterial_list)
|
|
{
|
|
await
|
|
PurchaseOrder1.
|
|
setMaterial_list(relatedMaterial_list1);
|
|
}
|
|
|
|
const relatedMaterial_list2 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const PurchaseOrder2 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrder2?.setMaterial_list)
|
|
{
|
|
await
|
|
PurchaseOrder2.
|
|
setMaterial_list(relatedMaterial_list2);
|
|
}
|
|
|
|
const relatedMaterial_list3 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const PurchaseOrder3 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrder3?.setMaterial_list)
|
|
{
|
|
await
|
|
PurchaseOrder3.
|
|
setMaterial_list(relatedMaterial_list3);
|
|
}
|
|
|
|
const relatedMaterial_list4 = await MaterialLists.findOne({
|
|
offset: Math.floor(Math.random() * (await MaterialLists.count())),
|
|
});
|
|
const PurchaseOrder4 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrder4?.setMaterial_list)
|
|
{
|
|
await
|
|
PurchaseOrder4.
|
|
setMaterial_list(relatedMaterial_list4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrder0 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrder0?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrder0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrder1 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrder1?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrder1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrder2 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrder2?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrder2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrder3 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrder3?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrder3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrder4 = await PurchaseOrders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrder4?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrder4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderItemWithPurchase_order() {
|
|
|
|
const relatedPurchase_order0 = await PurchaseOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
|
|
});
|
|
const PurchaseOrderItem0 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrderItem0?.setPurchase_order)
|
|
{
|
|
await
|
|
PurchaseOrderItem0.
|
|
setPurchase_order(relatedPurchase_order0);
|
|
}
|
|
|
|
const relatedPurchase_order1 = await PurchaseOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
|
|
});
|
|
const PurchaseOrderItem1 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrderItem1?.setPurchase_order)
|
|
{
|
|
await
|
|
PurchaseOrderItem1.
|
|
setPurchase_order(relatedPurchase_order1);
|
|
}
|
|
|
|
const relatedPurchase_order2 = await PurchaseOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
|
|
});
|
|
const PurchaseOrderItem2 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrderItem2?.setPurchase_order)
|
|
{
|
|
await
|
|
PurchaseOrderItem2.
|
|
setPurchase_order(relatedPurchase_order2);
|
|
}
|
|
|
|
const relatedPurchase_order3 = await PurchaseOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
|
|
});
|
|
const PurchaseOrderItem3 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrderItem3?.setPurchase_order)
|
|
{
|
|
await
|
|
PurchaseOrderItem3.
|
|
setPurchase_order(relatedPurchase_order3);
|
|
}
|
|
|
|
const relatedPurchase_order4 = await PurchaseOrders.findOne({
|
|
offset: Math.floor(Math.random() * (await PurchaseOrders.count())),
|
|
});
|
|
const PurchaseOrderItem4 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrderItem4?.setPurchase_order)
|
|
{
|
|
await
|
|
PurchaseOrderItem4.
|
|
setPurchase_order(relatedPurchase_order4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderItemWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const PurchaseOrderItem0 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrderItem0?.setProduct)
|
|
{
|
|
await
|
|
PurchaseOrderItem0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const PurchaseOrderItem1 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrderItem1?.setProduct)
|
|
{
|
|
await
|
|
PurchaseOrderItem1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const PurchaseOrderItem2 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrderItem2?.setProduct)
|
|
{
|
|
await
|
|
PurchaseOrderItem2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
const relatedProduct3 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const PurchaseOrderItem3 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrderItem3?.setProduct)
|
|
{
|
|
await
|
|
PurchaseOrderItem3.
|
|
setProduct(relatedProduct3);
|
|
}
|
|
|
|
const relatedProduct4 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const PurchaseOrderItem4 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrderItem4?.setProduct)
|
|
{
|
|
await
|
|
PurchaseOrderItem4.
|
|
setProduct(relatedProduct4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePurchaseOrderItemWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrderItem0 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (PurchaseOrderItem0?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrderItem0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrderItem1 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (PurchaseOrderItem1?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrderItem1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrderItem2 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (PurchaseOrderItem2?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrderItem2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrderItem3 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (PurchaseOrderItem3?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrderItem3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const PurchaseOrderItem4 = await PurchaseOrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (PurchaseOrderItem4?.setOrganization)
|
|
{
|
|
await
|
|
PurchaseOrderItem4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithProject() {
|
|
|
|
const relatedProject0 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setProject)
|
|
{
|
|
await
|
|
Task0.
|
|
setProject(relatedProject0);
|
|
}
|
|
|
|
const relatedProject1 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setProject)
|
|
{
|
|
await
|
|
Task1.
|
|
setProject(relatedProject1);
|
|
}
|
|
|
|
const relatedProject2 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setProject)
|
|
{
|
|
await
|
|
Task2.
|
|
setProject(relatedProject2);
|
|
}
|
|
|
|
const relatedProject3 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task3 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Task3?.setProject)
|
|
{
|
|
await
|
|
Task3.
|
|
setProject(relatedProject3);
|
|
}
|
|
|
|
const relatedProject4 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task4 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Task4?.setProject)
|
|
{
|
|
await
|
|
Task4.
|
|
setProject(relatedProject4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithAssignee() {
|
|
|
|
const relatedAssignee0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setAssignee)
|
|
{
|
|
await
|
|
Task0.
|
|
setAssignee(relatedAssignee0);
|
|
}
|
|
|
|
const relatedAssignee1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setAssignee)
|
|
{
|
|
await
|
|
Task1.
|
|
setAssignee(relatedAssignee1);
|
|
}
|
|
|
|
const relatedAssignee2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setAssignee)
|
|
{
|
|
await
|
|
Task2.
|
|
setAssignee(relatedAssignee2);
|
|
}
|
|
|
|
const relatedAssignee3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task3 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Task3?.setAssignee)
|
|
{
|
|
await
|
|
Task3.
|
|
setAssignee(relatedAssignee3);
|
|
}
|
|
|
|
const relatedAssignee4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task4 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Task4?.setAssignee)
|
|
{
|
|
await
|
|
Task4.
|
|
setAssignee(relatedAssignee4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setOrganization)
|
|
{
|
|
await
|
|
Task0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setOrganization)
|
|
{
|
|
await
|
|
Task1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setOrganization)
|
|
{
|
|
await
|
|
Task2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task3 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Task3?.setOrganization)
|
|
{
|
|
await
|
|
Task3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task4 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Task4?.setOrganization)
|
|
{
|
|
await
|
|
Task4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateNotificationWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Notification0 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Notification0?.setUser)
|
|
{
|
|
await
|
|
Notification0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Notification1 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Notification1?.setUser)
|
|
{
|
|
await
|
|
Notification1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Notification2 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Notification2?.setUser)
|
|
{
|
|
await
|
|
Notification2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Notification3 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Notification3?.setUser)
|
|
{
|
|
await
|
|
Notification3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Notification4 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Notification4?.setUser)
|
|
{
|
|
await
|
|
Notification4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateNotificationWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Notification0 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Notification0?.setOrganization)
|
|
{
|
|
await
|
|
Notification0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Notification1 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Notification1?.setOrganization)
|
|
{
|
|
await
|
|
Notification1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Notification2 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Notification2?.setOrganization)
|
|
{
|
|
await
|
|
Notification2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Notification3 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Notification3?.setOrganization)
|
|
{
|
|
await
|
|
Notification3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
const relatedOrganization4 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Notification4 = await Notifications.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Notification4?.setOrganization)
|
|
{
|
|
await
|
|
Notification4.
|
|
setOrganization(relatedOrganization4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Organizations.bulkCreate(OrganizationsData);
|
|
|
|
|
|
|
|
|
|
await Companies.bulkCreate(CompaniesData);
|
|
|
|
|
|
|
|
|
|
await Customers.bulkCreate(CustomersData);
|
|
|
|
|
|
|
|
|
|
await Sites.bulkCreate(SitesData);
|
|
|
|
|
|
|
|
|
|
await Projects.bulkCreate(ProjectsData);
|
|
|
|
|
|
|
|
|
|
await SiteVisits.bulkCreate(SiteVisitsData);
|
|
|
|
|
|
|
|
|
|
await PhotoInspections.bulkCreate(PhotoInspectionsData);
|
|
|
|
|
|
|
|
|
|
await Products.bulkCreate(ProductsData);
|
|
|
|
|
|
|
|
|
|
await Quotes.bulkCreate(QuotesData);
|
|
|
|
|
|
|
|
|
|
await QuoteItems.bulkCreate(QuoteItemsData);
|
|
|
|
|
|
|
|
|
|
await Signatures.bulkCreate(SignaturesData);
|
|
|
|
|
|
|
|
|
|
await MaterialLists.bulkCreate(MaterialListsData);
|
|
|
|
|
|
|
|
|
|
await MaterialListItems.bulkCreate(MaterialListItemsData);
|
|
|
|
|
|
|
|
|
|
await PurchaseOrders.bulkCreate(PurchaseOrdersData);
|
|
|
|
|
|
|
|
|
|
await PurchaseOrderItems.bulkCreate(PurchaseOrderItemsData);
|
|
|
|
|
|
|
|
|
|
await Tasks.bulkCreate(TasksData);
|
|
|
|
|
|
|
|
|
|
await Notifications.bulkCreate(NotificationsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
await associateUserWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCompanyWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCustomerWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCustomerWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSiteWithCustomer(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSiteWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProjectWithCompany(),
|
|
|
|
|
|
|
|
|
|
await associateProjectWithCustomer(),
|
|
|
|
|
|
|
|
|
|
await associateProjectWithSite(),
|
|
|
|
|
|
|
|
|
|
await associateProjectWithAssigned_to(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProjectWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSiteVisitWithProject(),
|
|
|
|
|
|
|
|
|
|
await associateSiteVisitWithTechnician(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSiteVisitWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePhotoInspectionWithProject(),
|
|
|
|
|
|
|
|
|
|
await associatePhotoInspectionWithCaptured_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePhotoInspectionWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductWithCompany(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQuoteWithProject(),
|
|
|
|
|
|
|
|
|
|
await associateQuoteWithPrepared_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQuoteWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQuoteItemWithQuote(),
|
|
|
|
|
|
|
|
|
|
await associateQuoteItemWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateQuoteItemWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSignatureWithQuote(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSignatureWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialListWithProject(),
|
|
|
|
|
|
|
|
|
|
await associateMaterialListWithQuote(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialListWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialListItemWithMaterial_list(),
|
|
|
|
|
|
|
|
|
|
await associateMaterialListItemWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateMaterialListItemWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderWithCompany(),
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderWithMaterial_list(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderItemWithPurchase_order(),
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderItemWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePurchaseOrderItemWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskWithProject(),
|
|
|
|
|
|
|
|
|
|
await associateTaskWithAssignee(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNotificationWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateNotificationWithOrganization(),
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('organizations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('companies', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('customers', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('sites', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('projects', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('site_visits', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('photo_inspections', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('products', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('quotes', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('quote_items', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('signatures', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('material_lists', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('material_list_items', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('purchase_orders', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('purchase_order_items', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('tasks', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('notifications', null, {});
|
|
|
|
|
|
},
|
|
}; |