Umbau zu location / companyLocation
This commit is contained in:
parent
1a77656d8a
commit
7df5d32cc4
|
|
@ -698,7 +698,7 @@
|
||||||
"realEstateIncluded": true,
|
"realEstateIncluded": true,
|
||||||
"franchiseResale": false,
|
"franchiseResale": false,
|
||||||
"draft": false,
|
"draft": false,
|
||||||
"internals": "",
|
"internals": null,
|
||||||
"created": "2023-11-18T13:00:00.000Z"
|
"created": "2023-11-18T13:00:00.000Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -7,14 +7,53 @@ import { join } from 'path';
|
||||||
import pkg from 'pg';
|
import pkg from 'pg';
|
||||||
import { rimraf } from 'rimraf';
|
import { rimraf } from 'rimraf';
|
||||||
import sharp from 'sharp';
|
import sharp from 'sharp';
|
||||||
|
import { BusinessListingService } from 'src/listings/business-listing.service.js';
|
||||||
|
import { CommercialPropertyService } from 'src/listings/commercial-property.service.js';
|
||||||
import { Geo } from 'src/models/server.model.js';
|
import { Geo } from 'src/models/server.model.js';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
import { BusinessListing, CommercialPropertyListing, User, UserData } from '../models/db.model.js';
|
import { User, UserData } from '../models/db.model.js';
|
||||||
import { createDefaultUser, emailToDirName, KeyValueStyle } from '../models/main.model.js';
|
import { createDefaultBusinessListing, createDefaultCommercialPropertyListing, createDefaultUser, emailToDirName, KeyValueStyle } from '../models/main.model.js';
|
||||||
import { SelectOptionsService } from '../select-options/select-options.service.js';
|
import { SelectOptionsService } from '../select-options/select-options.service.js';
|
||||||
import { convertUserToDrizzleUser } from '../utils.js';
|
import { convertUserToDrizzleUser } from '../utils.js';
|
||||||
import * as schema from './schema.js';
|
import * as schema from './schema.js';
|
||||||
|
interface PropertyImportListing {
|
||||||
|
id: string;
|
||||||
|
userId: string;
|
||||||
|
listingsCategory: 'commercialProperty';
|
||||||
|
title: string;
|
||||||
|
state: string;
|
||||||
|
hasImages: boolean;
|
||||||
|
price: number;
|
||||||
|
city: string;
|
||||||
|
description: string;
|
||||||
|
type: number;
|
||||||
|
imageOrder: any[];
|
||||||
|
}
|
||||||
|
interface BusinessImportListing {
|
||||||
|
userId: string;
|
||||||
|
listingsCategory: 'business';
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
type: number;
|
||||||
|
state: string;
|
||||||
|
city: string;
|
||||||
|
id: string;
|
||||||
|
price: number;
|
||||||
|
salesRevenue: number;
|
||||||
|
leasedLocation: boolean;
|
||||||
|
established: number;
|
||||||
|
employees: number;
|
||||||
|
reasonForSale: string;
|
||||||
|
supportAndTraining: string;
|
||||||
|
cashFlow: number;
|
||||||
|
brokerLicencing: string;
|
||||||
|
internalListingNumber: number;
|
||||||
|
realEstateIncluded: boolean;
|
||||||
|
franchiseResale: boolean;
|
||||||
|
draft: boolean;
|
||||||
|
internals: string;
|
||||||
|
created: string;
|
||||||
|
}
|
||||||
const typesOfBusiness: Array<KeyValueStyle> = [
|
const typesOfBusiness: Array<KeyValueStyle> = [
|
||||||
{ name: 'Automotive', value: '1', icon: 'fa-solid fa-car', textColorClass: 'text-green-400' },
|
{ name: 'Automotive', value: '1', icon: 'fa-solid fa-car', textColorClass: 'text-green-400' },
|
||||||
{ name: 'Industrial Services', value: '2', icon: 'fa-solid fa-industry', textColorClass: 'text-yellow-400' },
|
{ name: 'Industrial Services', value: '2', icon: 'fa-solid fa-industry', textColorClass: 'text-yellow-400' },
|
||||||
|
|
@ -43,6 +82,8 @@ const db = drizzle(client, { schema, logger: true });
|
||||||
const logger = winston.createLogger({
|
const logger = winston.createLogger({
|
||||||
transports: [new winston.transports.Console()],
|
transports: [new winston.transports.Console()],
|
||||||
});
|
});
|
||||||
|
const commService = new CommercialPropertyService(null, db);
|
||||||
|
const businessService = new BusinessListingService(null, db);
|
||||||
//Delete Content
|
//Delete Content
|
||||||
await db.delete(schema.commercials);
|
await db.delete(schema.commercials);
|
||||||
await db.delete(schema.businesses);
|
await db.delete(schema.businesses);
|
||||||
|
|
@ -70,13 +111,11 @@ deleteFilesOfDir(targetPathProperty);
|
||||||
fs.ensureDirSync(`./pictures/logo`);
|
fs.ensureDirSync(`./pictures/logo`);
|
||||||
fs.ensureDirSync(`./pictures/profile`);
|
fs.ensureDirSync(`./pictures/profile`);
|
||||||
fs.ensureDirSync(`./pictures/property`);
|
fs.ensureDirSync(`./pictures/property`);
|
||||||
// type UserProfile = Omit<User, 'created' | 'updated' | 'hasCompanyLogo' | 'hasProfile' | 'id'>;
|
|
||||||
|
|
||||||
// type NewUser = typeof users.$inferInsert;
|
//User
|
||||||
//for (const userData of usersData) {
|
|
||||||
for (let index = 0; index < usersData.length; index++) {
|
for (let index = 0; index < usersData.length; index++) {
|
||||||
const userData = usersData[index];
|
const userData = usersData[index];
|
||||||
const user: User = createDefaultUser('', '', ''); //{ id: undefined, firstname: '', lastname: '', email: '' };
|
const user: User = createDefaultUser('', '', '');
|
||||||
user.licensedIn = [];
|
user.licensedIn = [];
|
||||||
userData.licensedIn.forEach(l => {
|
userData.licensedIn.forEach(l => {
|
||||||
console.log(l['value'], l['name']);
|
console.log(l['value'], l['name']);
|
||||||
|
|
@ -133,89 +172,91 @@ for (let index = 0; index < usersData.length; index++) {
|
||||||
//Corporate Listings
|
//Corporate Listings
|
||||||
filePath = `./data/commercials.json`;
|
filePath = `./data/commercials.json`;
|
||||||
data = readFileSync(filePath, 'utf8');
|
data = readFileSync(filePath, 'utf8');
|
||||||
const commercialJsonData = JSON.parse(data) as CommercialPropertyListing[]; // Erwartet ein Array von Objekten
|
const commercialJsonData = JSON.parse(data) as PropertyImportListing[]; // Erwartet ein Array von Objekten
|
||||||
for (let index = 0; index < commercialJsonData.length; index++) {
|
for (let index = 0; index < commercialJsonData.length; index++) {
|
||||||
const commercial = commercialJsonData[index];
|
|
||||||
const id = commercial.id;
|
|
||||||
delete commercial.id;
|
|
||||||
const user = getRandomItem(generatedUserData);
|
const user = getRandomItem(generatedUserData);
|
||||||
|
const commercial = createDefaultCommercialPropertyListing();
|
||||||
|
const id = commercialJsonData[index].id;
|
||||||
|
delete commercial.id;
|
||||||
|
|
||||||
|
commercial.email = user.email;
|
||||||
|
commercial.type = sso.typesOfCommercialProperty.find(e => e.oldValue === String(commercialJsonData[index].type)).value;
|
||||||
|
commercial.title = commercialJsonData[index].title;
|
||||||
|
commercial.description = commercialJsonData[index].description;
|
||||||
|
try {
|
||||||
|
const cityGeo = geos.states.find(s => s.state_code === commercialJsonData[index].state).cities.find(c => c.name === commercialJsonData[index].city);
|
||||||
|
commercial.location = {};
|
||||||
|
commercial.location.latitude = cityGeo.latitude;
|
||||||
|
commercial.location.longitude = cityGeo.longitude;
|
||||||
|
commercial.location.city = commercialJsonData[index].city;
|
||||||
|
commercial.location.state = commercialJsonData[index].state;
|
||||||
|
// console.log(JSON.stringify(commercial.location));
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`----------------> ERROR ${commercialJsonData[index].state} - ${commercialJsonData[index].city}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
commercial.price = commercialJsonData[index].price;
|
||||||
|
commercial.listingsCategory = 'commercialProperty';
|
||||||
|
commercial.draft = false;
|
||||||
commercial.imageOrder = getFilenames(id);
|
commercial.imageOrder = getFilenames(id);
|
||||||
commercial.imagePath = emailToDirName(user.email);
|
commercial.imagePath = emailToDirName(user.email);
|
||||||
const insertionDate = getRandomDateWithinLastYear();
|
const insertionDate = getRandomDateWithinLastYear();
|
||||||
commercial.created = insertionDate;
|
commercial.created = insertionDate;
|
||||||
commercial.updated = insertionDate;
|
commercial.updated = insertionDate;
|
||||||
commercial.email = user.email;
|
|
||||||
commercial.draft = false;
|
const result = await commService.createListing(commercial); //await db.insert(schema.commercials).values(commercial).returning();
|
||||||
commercial.type = sso.typesOfCommercialProperty.find(e => e.oldValue === String(commercial.type)).value;
|
|
||||||
const cityGeo = geos.states.find(s => s.state_code === commercial.state).cities.find(c => c.name === commercial.city);
|
|
||||||
try {
|
try {
|
||||||
commercial.latitude = cityGeo.latitude;
|
fs.copySync(`./pictures_base/property/${id}`, `./pictures/property/${result.imagePath}/${result.serialId}`);
|
||||||
commercial.longitude = cityGeo.longitude;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(`----------------> ERROR ${commercial.state} - ${commercial.city}`);
|
|
||||||
}
|
|
||||||
// const reducedCommercial = {
|
|
||||||
// city: commercial.city,
|
|
||||||
// description: commercial.description,
|
|
||||||
// email: commercial.email,
|
|
||||||
// price: commercial.price,
|
|
||||||
// state: sso.locations.find(l => l.value === commercial.state)?.name,
|
|
||||||
// title: commercial.title,
|
|
||||||
// name: `${user.firstname} ${user.lastname}`,
|
|
||||||
// };
|
|
||||||
// const embedding = await createEmbedding(JSON.stringify(reducedCommercial));
|
|
||||||
// sleep(200);
|
|
||||||
const result = await db.insert(schema.commercials).values(commercial).returning();
|
|
||||||
// logger.info(`commercial_${index} inserted`);
|
|
||||||
try {
|
|
||||||
fs.copySync(`./pictures_base/property/${id}`, `./pictures/property/${result[0].imagePath}/${result[0].serialId}`);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`----- No pictures available for ${id} ------`);
|
console.log(`----- No pictures available for ${id} ------ ${err}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Business Listings
|
//Business Listings
|
||||||
filePath = `./data/businesses.json`;
|
filePath = `./data/businesses.json`;
|
||||||
data = readFileSync(filePath, 'utf8');
|
data = readFileSync(filePath, 'utf8');
|
||||||
const businessJsonData = JSON.parse(data) as BusinessListing[]; // Erwartet ein Array von Objekten
|
const businessJsonData = JSON.parse(data) as BusinessImportListing[]; // Erwartet ein Array von Objekten
|
||||||
for (let index = 0; index < businessJsonData.length; index++) {
|
for (let index = 0; index < businessJsonData.length; index++) {
|
||||||
const business = businessJsonData[index];
|
const business = createDefaultBusinessListing(); //businessJsonData[index];
|
||||||
delete business.id;
|
delete business.id;
|
||||||
business.type = sso.typesOfBusiness.find(e => e.oldValue === String(business.type)).value;
|
|
||||||
business.created = new Date(business.created);
|
|
||||||
business.updated = new Date(business.created);
|
|
||||||
const user = getRandomItem(generatedUserData);
|
const user = getRandomItem(generatedUserData);
|
||||||
business.email = user.email;
|
business.email = user.email;
|
||||||
business.imageName = emailToDirName(user.email);
|
business.type = sso.typesOfBusiness.find(e => e.oldValue === String(businessJsonData[index].type)).value;
|
||||||
const cityGeo = geos.states.find(s => s.state_code === business.state).cities.find(c => c.name === business.city);
|
business.title = businessJsonData[index].title;
|
||||||
|
business.description = businessJsonData[index].description;
|
||||||
try {
|
try {
|
||||||
business.latitude = cityGeo.latitude;
|
const cityGeo = geos.states.find(s => s.state_code === businessJsonData[index].state).cities.find(c => c.name === businessJsonData[index].city);
|
||||||
business.longitude = cityGeo.longitude;
|
business.location = {};
|
||||||
|
business.location.latitude = cityGeo.latitude;
|
||||||
|
business.location.longitude = cityGeo.longitude;
|
||||||
|
business.location.city = businessJsonData[index].city;
|
||||||
|
business.location.state = businessJsonData[index].state;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`----------------> ERROR ${business.state} - ${business.city}`);
|
console.log(`----------------> ERROR ${businessJsonData[index].state} - ${businessJsonData[index].city}`);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
// const embeddingText = JSON.stringify({
|
business.price = businessJsonData[index].price;
|
||||||
// type: typesOfBusiness.find(b => b.value === String(business.type))?.name,
|
business.title = businessJsonData[index].title;
|
||||||
// title: business.title,
|
business.draft = businessJsonData[index].draft;
|
||||||
// description: business.description,
|
business.listingsCategory = 'business';
|
||||||
// email: business.email,
|
business.realEstateIncluded = businessJsonData[index].realEstateIncluded;
|
||||||
// city: business.city,
|
business.leasedLocation = businessJsonData[index].leasedLocation;
|
||||||
// state: sso.locations.find(l => l.value === business.state)?.name,
|
business.franchiseResale = businessJsonData[index].franchiseResale;
|
||||||
// price: business.price,
|
|
||||||
// realEstateIncluded: business.realEstateIncluded,
|
business.salesRevenue = businessJsonData[index].salesRevenue;
|
||||||
// leasedLocation: business.leasedLocation,
|
business.cashFlow = businessJsonData[index].cashFlow;
|
||||||
// franchiseResale: business.franchiseResale,
|
business.supportAndTraining = businessJsonData[index].supportAndTraining;
|
||||||
// salesRevenue: business.salesRevenue,
|
business.employees = businessJsonData[index].employees;
|
||||||
// cashFlow: business.cashFlow,
|
business.established = businessJsonData[index].established;
|
||||||
// supportAndTraining: business.supportAndTraining,
|
business.internalListingNumber = businessJsonData[index].internalListingNumber;
|
||||||
// employees: business.employees,
|
business.reasonForSale = businessJsonData[index].reasonForSale;
|
||||||
// established: business.established,
|
business.brokerLicencing = businessJsonData[index].brokerLicencing;
|
||||||
// reasonForSale: business.reasonForSale,
|
business.internals = businessJsonData[index].internals;
|
||||||
// name: `${user.firstname} ${user.lastname}`,
|
business.imageName = emailToDirName(user.email);
|
||||||
// });
|
business.created = new Date(businessJsonData[index].created);
|
||||||
// const embedding = await createEmbedding(embeddingText);
|
business.updated = new Date(businessJsonData[index].created);
|
||||||
sleep(200);
|
|
||||||
await db.insert(schema.businesses).values(business);
|
await businessService.createListing(business); //db.insert(schema.businesses).values(business);
|
||||||
}
|
}
|
||||||
|
|
||||||
//End
|
//End
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ CREATE TABLE IF NOT EXISTS "businesses" (
|
||||||
"description" text,
|
"description" text,
|
||||||
"city" varchar(255),
|
"city" varchar(255),
|
||||||
"state" char(2),
|
"state" char(2),
|
||||||
"zipCode" integer,
|
|
||||||
"county" varchar(255),
|
|
||||||
"price" double precision,
|
"price" double precision,
|
||||||
"favoritesForUser" varchar(30)[],
|
"favoritesForUser" varchar(30)[],
|
||||||
"draft" boolean,
|
"draft" boolean,
|
||||||
|
|
@ -51,15 +49,13 @@ CREATE TABLE IF NOT EXISTS "businesses" (
|
||||||
"imageName" varchar(200),
|
"imageName" varchar(200),
|
||||||
"created" timestamp,
|
"created" timestamp,
|
||||||
"updated" timestamp,
|
"updated" timestamp,
|
||||||
"visits" integer,
|
|
||||||
"lastVisit" timestamp,
|
|
||||||
"latitude" double precision,
|
"latitude" double precision,
|
||||||
"longitude" double precision
|
"longitude" double precision
|
||||||
);
|
);
|
||||||
--> statement-breakpoint
|
--> statement-breakpoint
|
||||||
CREATE TABLE IF NOT EXISTS "commercials" (
|
CREATE TABLE IF NOT EXISTS "commercials" (
|
||||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
"serial_id" serial NOT NULL,
|
"serialId" serial NOT NULL,
|
||||||
"email" varchar(255),
|
"email" varchar(255),
|
||||||
"type" varchar(255),
|
"type" varchar(255),
|
||||||
"title" varchar(255),
|
"title" varchar(255),
|
||||||
|
|
@ -69,16 +65,11 @@ CREATE TABLE IF NOT EXISTS "commercials" (
|
||||||
"price" double precision,
|
"price" double precision,
|
||||||
"favoritesForUser" varchar(30)[],
|
"favoritesForUser" varchar(30)[],
|
||||||
"listingsCategory" "listingsCategory",
|
"listingsCategory" "listingsCategory",
|
||||||
"hideImage" boolean,
|
|
||||||
"draft" boolean,
|
"draft" boolean,
|
||||||
"zipCode" integer,
|
|
||||||
"county" varchar(255),
|
|
||||||
"imageOrder" varchar(200)[],
|
"imageOrder" varchar(200)[],
|
||||||
"imagePath" varchar(200),
|
"imagePath" varchar(200),
|
||||||
"created" timestamp,
|
"created" timestamp,
|
||||||
"updated" timestamp,
|
"updated" timestamp,
|
||||||
"visits" integer,
|
|
||||||
"lastVisit" timestamp,
|
|
||||||
"latitude" double precision,
|
"latitude" double precision,
|
||||||
"longitude" double precision
|
"longitude" double precision
|
||||||
);
|
);
|
||||||
|
|
@ -93,7 +84,8 @@ CREATE TABLE IF NOT EXISTS "users" (
|
||||||
"companyName" varchar(255),
|
"companyName" varchar(255),
|
||||||
"companyOverview" text,
|
"companyOverview" text,
|
||||||
"companyWebsite" varchar(255),
|
"companyWebsite" varchar(255),
|
||||||
"companyLocation" varchar(255),
|
"city" varchar(255),
|
||||||
|
"state" char(2),
|
||||||
"offeredServices" text,
|
"offeredServices" text,
|
||||||
"areasServed" jsonb,
|
"areasServed" jsonb,
|
||||||
"hasProfile" boolean,
|
"hasProfile" boolean,
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
ALTER TABLE "commercials" RENAME COLUMN "serial_id" TO "serialId";
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
ALTER TABLE "commercials" DROP COLUMN IF EXISTS "hideImage";
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
ALTER TABLE "users" ADD COLUMN "city" varchar(255);--> statement-breakpoint
|
|
||||||
ALTER TABLE "users" ADD COLUMN "state" char(2);--> statement-breakpoint
|
|
||||||
ALTER TABLE "users" DROP COLUMN IF EXISTS "companyLocation";
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"id": "aa3e53ed-4f1b-4e00-84ea-58939189a427",
|
"id": "a8283ca6-2c10-42bb-a640-ca984544ba30",
|
||||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"dialect": "postgresql",
|
"dialect": "postgresql",
|
||||||
|
|
@ -51,18 +51,6 @@
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
"price": {
|
||||||
"name": "price",
|
"name": "price",
|
||||||
"type": "double precision",
|
"type": "double precision",
|
||||||
|
|
@ -178,18 +166,6 @@
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
"latitude": {
|
||||||
"name": "latitude",
|
"name": "latitude",
|
||||||
"type": "double precision",
|
"type": "double precision",
|
||||||
|
|
@ -233,8 +209,8 @@
|
||||||
"notNull": true,
|
"notNull": true,
|
||||||
"default": "gen_random_uuid()"
|
"default": "gen_random_uuid()"
|
||||||
},
|
},
|
||||||
"serial_id": {
|
"serialId": {
|
||||||
"name": "serial_id",
|
"name": "serialId",
|
||||||
"type": "serial",
|
"type": "serial",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
|
|
@ -294,30 +270,12 @@
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
"hideImage": {
|
|
||||||
"name": "hideImage",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
"draft": {
|
||||||
"name": "draft",
|
"name": "draft",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageOrder": {
|
"imageOrder": {
|
||||||
"name": "imageOrder",
|
"name": "imageOrder",
|
||||||
"type": "varchar(200)[]",
|
"type": "varchar(200)[]",
|
||||||
|
|
@ -342,18 +300,6 @@
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
"latitude": {
|
||||||
"name": "latitude",
|
"name": "latitude",
|
||||||
"type": "double precision",
|
"type": "double precision",
|
||||||
|
|
@ -445,12 +391,18 @@
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
"companyLocation": {
|
"city": {
|
||||||
"name": "companyLocation",
|
"name": "city",
|
||||||
"type": "varchar(255)",
|
"type": "varchar(255)",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
|
"state": {
|
||||||
|
"name": "state",
|
||||||
|
"type": "char(2)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
"offeredServices": {
|
"offeredServices": {
|
||||||
"name": "offeredServices",
|
"name": "offeredServices",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
||||||
|
|
@ -1,589 +0,0 @@
|
||||||
{
|
|
||||||
"id": "ff415931-0de6-4c89-900f-c6fd64830b2e",
|
|
||||||
"prevId": "aa3e53ed-4f1b-4e00-84ea-58939189a427",
|
|
||||||
"version": "7",
|
|
||||||
"dialect": "postgresql",
|
|
||||||
"tables": {
|
|
||||||
"public.businesses": {
|
|
||||||
"name": "businesses",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "listingsCategory",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"realEstateIncluded": {
|
|
||||||
"name": "realEstateIncluded",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"leasedLocation": {
|
|
||||||
"name": "leasedLocation",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"franchiseResale": {
|
|
||||||
"name": "franchiseResale",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"salesRevenue": {
|
|
||||||
"name": "salesRevenue",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"cashFlow": {
|
|
||||||
"name": "cashFlow",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"supportAndTraining": {
|
|
||||||
"name": "supportAndTraining",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"employees": {
|
|
||||||
"name": "employees",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"established": {
|
|
||||||
"name": "established",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internalListingNumber": {
|
|
||||||
"name": "internalListingNumber",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"reasonForSale": {
|
|
||||||
"name": "reasonForSale",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"brokerLicencing": {
|
|
||||||
"name": "brokerLicencing",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internals": {
|
|
||||||
"name": "internals",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageName": {
|
|
||||||
"name": "imageName",
|
|
||||||
"type": "varchar(200)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"businesses_email_users_email_fk": {
|
|
||||||
"name": "businesses_email_users_email_fk",
|
|
||||||
"tableFrom": "businesses",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"public.commercials": {
|
|
||||||
"name": "commercials",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"serialId": {
|
|
||||||
"name": "serialId",
|
|
||||||
"type": "serial",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "listingsCategory",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hideImage": {
|
|
||||||
"name": "hideImage",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageOrder": {
|
|
||||||
"name": "imageOrder",
|
|
||||||
"type": "varchar(200)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imagePath": {
|
|
||||||
"name": "imagePath",
|
|
||||||
"type": "varchar(200)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"commercials_email_users_email_fk": {
|
|
||||||
"name": "commercials_email_users_email_fk",
|
|
||||||
"tableFrom": "commercials",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"public.users": {
|
|
||||||
"name": "users",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"firstname": {
|
|
||||||
"name": "firstname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"lastname": {
|
|
||||||
"name": "lastname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"phoneNumber": {
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyName": {
|
|
||||||
"name": "companyName",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyOverview": {
|
|
||||||
"name": "companyOverview",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyWebsite": {
|
|
||||||
"name": "companyWebsite",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyLocation": {
|
|
||||||
"name": "companyLocation",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"offeredServices": {
|
|
||||||
"name": "offeredServices",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"areasServed": {
|
|
||||||
"name": "areasServed",
|
|
||||||
"type": "jsonb",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasProfile": {
|
|
||||||
"name": "hasProfile",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasCompanyLogo": {
|
|
||||||
"name": "hasCompanyLogo",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"licensedIn": {
|
|
||||||
"name": "licensedIn",
|
|
||||||
"type": "jsonb",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"type": "gender",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"customerType": {
|
|
||||||
"name": "customerType",
|
|
||||||
"type": "customerType",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"customerSubType": {
|
|
||||||
"name": "customerSubType",
|
|
||||||
"type": "customerSubType",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {
|
|
||||||
"users_email_unique": {
|
|
||||||
"name": "users_email_unique",
|
|
||||||
"nullsNotDistinct": false,
|
|
||||||
"columns": [
|
|
||||||
"email"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enums": {
|
|
||||||
"public.customerSubType": {
|
|
||||||
"name": "customerSubType",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"broker",
|
|
||||||
"cpa",
|
|
||||||
"attorney",
|
|
||||||
"titleCompany",
|
|
||||||
"surveyor",
|
|
||||||
"appraiser"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.customerType": {
|
|
||||||
"name": "customerType",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"buyer",
|
|
||||||
"professional"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"male",
|
|
||||||
"female"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"commercialProperty",
|
|
||||||
"business"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"schemas": {},
|
|
||||||
"sequences": {},
|
|
||||||
"_meta": {
|
|
||||||
"columns": {},
|
|
||||||
"schemas": {},
|
|
||||||
"tables": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,583 +0,0 @@
|
||||||
{
|
|
||||||
"id": "146c197a-0ef7-4b10-84cd-352b88aba859",
|
|
||||||
"prevId": "ff415931-0de6-4c89-900f-c6fd64830b2e",
|
|
||||||
"version": "7",
|
|
||||||
"dialect": "postgresql",
|
|
||||||
"tables": {
|
|
||||||
"public.businesses": {
|
|
||||||
"name": "businesses",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "listingsCategory",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"realEstateIncluded": {
|
|
||||||
"name": "realEstateIncluded",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"leasedLocation": {
|
|
||||||
"name": "leasedLocation",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"franchiseResale": {
|
|
||||||
"name": "franchiseResale",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"salesRevenue": {
|
|
||||||
"name": "salesRevenue",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"cashFlow": {
|
|
||||||
"name": "cashFlow",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"supportAndTraining": {
|
|
||||||
"name": "supportAndTraining",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"employees": {
|
|
||||||
"name": "employees",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"established": {
|
|
||||||
"name": "established",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internalListingNumber": {
|
|
||||||
"name": "internalListingNumber",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"reasonForSale": {
|
|
||||||
"name": "reasonForSale",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"brokerLicencing": {
|
|
||||||
"name": "brokerLicencing",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internals": {
|
|
||||||
"name": "internals",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageName": {
|
|
||||||
"name": "imageName",
|
|
||||||
"type": "varchar(200)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"businesses_email_users_email_fk": {
|
|
||||||
"name": "businesses_email_users_email_fk",
|
|
||||||
"tableFrom": "businesses",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"public.commercials": {
|
|
||||||
"name": "commercials",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"serialId": {
|
|
||||||
"name": "serialId",
|
|
||||||
"type": "serial",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "listingsCategory",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageOrder": {
|
|
||||||
"name": "imageOrder",
|
|
||||||
"type": "varchar(200)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imagePath": {
|
|
||||||
"name": "imagePath",
|
|
||||||
"type": "varchar(200)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"commercials_email_users_email_fk": {
|
|
||||||
"name": "commercials_email_users_email_fk",
|
|
||||||
"tableFrom": "commercials",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"public.users": {
|
|
||||||
"name": "users",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"firstname": {
|
|
||||||
"name": "firstname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"lastname": {
|
|
||||||
"name": "lastname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"phoneNumber": {
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyName": {
|
|
||||||
"name": "companyName",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyOverview": {
|
|
||||||
"name": "companyOverview",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyWebsite": {
|
|
||||||
"name": "companyWebsite",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyLocation": {
|
|
||||||
"name": "companyLocation",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"offeredServices": {
|
|
||||||
"name": "offeredServices",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"areasServed": {
|
|
||||||
"name": "areasServed",
|
|
||||||
"type": "jsonb",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasProfile": {
|
|
||||||
"name": "hasProfile",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasCompanyLogo": {
|
|
||||||
"name": "hasCompanyLogo",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"licensedIn": {
|
|
||||||
"name": "licensedIn",
|
|
||||||
"type": "jsonb",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"type": "gender",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"customerType": {
|
|
||||||
"name": "customerType",
|
|
||||||
"type": "customerType",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"customerSubType": {
|
|
||||||
"name": "customerSubType",
|
|
||||||
"type": "customerSubType",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {
|
|
||||||
"users_email_unique": {
|
|
||||||
"name": "users_email_unique",
|
|
||||||
"nullsNotDistinct": false,
|
|
||||||
"columns": [
|
|
||||||
"email"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enums": {
|
|
||||||
"public.customerSubType": {
|
|
||||||
"name": "customerSubType",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"broker",
|
|
||||||
"cpa",
|
|
||||||
"attorney",
|
|
||||||
"titleCompany",
|
|
||||||
"surveyor",
|
|
||||||
"appraiser"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.customerType": {
|
|
||||||
"name": "customerType",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"buyer",
|
|
||||||
"professional"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"male",
|
|
||||||
"female"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"commercialProperty",
|
|
||||||
"business"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"schemas": {},
|
|
||||||
"sequences": {},
|
|
||||||
"_meta": {
|
|
||||||
"columns": {},
|
|
||||||
"schemas": {},
|
|
||||||
"tables": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,589 +0,0 @@
|
||||||
{
|
|
||||||
"id": "1d2566aa-6103-4520-a648-c0abdda08189",
|
|
||||||
"prevId": "146c197a-0ef7-4b10-84cd-352b88aba859",
|
|
||||||
"version": "7",
|
|
||||||
"dialect": "postgresql",
|
|
||||||
"tables": {
|
|
||||||
"public.businesses": {
|
|
||||||
"name": "businesses",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "listingsCategory",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"realEstateIncluded": {
|
|
||||||
"name": "realEstateIncluded",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"leasedLocation": {
|
|
||||||
"name": "leasedLocation",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"franchiseResale": {
|
|
||||||
"name": "franchiseResale",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"salesRevenue": {
|
|
||||||
"name": "salesRevenue",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"cashFlow": {
|
|
||||||
"name": "cashFlow",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"supportAndTraining": {
|
|
||||||
"name": "supportAndTraining",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"employees": {
|
|
||||||
"name": "employees",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"established": {
|
|
||||||
"name": "established",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internalListingNumber": {
|
|
||||||
"name": "internalListingNumber",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"reasonForSale": {
|
|
||||||
"name": "reasonForSale",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"brokerLicencing": {
|
|
||||||
"name": "brokerLicencing",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internals": {
|
|
||||||
"name": "internals",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageName": {
|
|
||||||
"name": "imageName",
|
|
||||||
"type": "varchar(200)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"businesses_email_users_email_fk": {
|
|
||||||
"name": "businesses_email_users_email_fk",
|
|
||||||
"tableFrom": "businesses",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"public.commercials": {
|
|
||||||
"name": "commercials",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"serialId": {
|
|
||||||
"name": "serialId",
|
|
||||||
"type": "serial",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "listingsCategory",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageOrder": {
|
|
||||||
"name": "imageOrder",
|
|
||||||
"type": "varchar(200)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imagePath": {
|
|
||||||
"name": "imagePath",
|
|
||||||
"type": "varchar(200)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"commercials_email_users_email_fk": {
|
|
||||||
"name": "commercials_email_users_email_fk",
|
|
||||||
"tableFrom": "commercials",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"public.users": {
|
|
||||||
"name": "users",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"firstname": {
|
|
||||||
"name": "firstname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"lastname": {
|
|
||||||
"name": "lastname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"phoneNumber": {
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyName": {
|
|
||||||
"name": "companyName",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyOverview": {
|
|
||||||
"name": "companyOverview",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyWebsite": {
|
|
||||||
"name": "companyWebsite",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"offeredServices": {
|
|
||||||
"name": "offeredServices",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"areasServed": {
|
|
||||||
"name": "areasServed",
|
|
||||||
"type": "jsonb",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasProfile": {
|
|
||||||
"name": "hasProfile",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasCompanyLogo": {
|
|
||||||
"name": "hasCompanyLogo",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"licensedIn": {
|
|
||||||
"name": "licensedIn",
|
|
||||||
"type": "jsonb",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"type": "gender",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"customerType": {
|
|
||||||
"name": "customerType",
|
|
||||||
"type": "customerType",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"customerSubType": {
|
|
||||||
"name": "customerSubType",
|
|
||||||
"type": "customerSubType",
|
|
||||||
"typeSchema": "public",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"latitude": {
|
|
||||||
"name": "latitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"longitude": {
|
|
||||||
"name": "longitude",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {
|
|
||||||
"users_email_unique": {
|
|
||||||
"name": "users_email_unique",
|
|
||||||
"nullsNotDistinct": false,
|
|
||||||
"columns": [
|
|
||||||
"email"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enums": {
|
|
||||||
"public.customerSubType": {
|
|
||||||
"name": "customerSubType",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"broker",
|
|
||||||
"cpa",
|
|
||||||
"attorney",
|
|
||||||
"titleCompany",
|
|
||||||
"surveyor",
|
|
||||||
"appraiser"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.customerType": {
|
|
||||||
"name": "customerType",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"buyer",
|
|
||||||
"professional"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"male",
|
|
||||||
"female"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"public.listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"schema": "public",
|
|
||||||
"values": [
|
|
||||||
"commercialProperty",
|
|
||||||
"business"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"schemas": {},
|
|
||||||
"sequences": {},
|
|
||||||
"_meta": {
|
|
||||||
"columns": {},
|
|
||||||
"schemas": {},
|
|
||||||
"tables": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,29 +5,8 @@
|
||||||
{
|
{
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"when": 1721737805677,
|
"when": 1723045357281,
|
||||||
"tag": "0000_freezing_vengeance",
|
"tag": "0000_lean_marvex",
|
||||||
"breakpoints": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idx": 1,
|
|
||||||
"version": "7",
|
|
||||||
"when": 1721738173220,
|
|
||||||
"tag": "0001_steady_phantom_reporter",
|
|
||||||
"breakpoints": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idx": 2,
|
|
||||||
"version": "7",
|
|
||||||
"when": 1722853523826,
|
|
||||||
"tag": "0002_chemical_gambit",
|
|
||||||
"breakpoints": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idx": 3,
|
|
||||||
"version": "7",
|
|
||||||
"when": 1722964164111,
|
|
||||||
"tag": "0003_robust_blockbuster",
|
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ export const businesses = pgTable('businesses', {
|
||||||
description: text('description'),
|
description: text('description'),
|
||||||
city: varchar('city', { length: 255 }),
|
city: varchar('city', { length: 255 }),
|
||||||
state: char('state', { length: 2 }),
|
state: char('state', { length: 2 }),
|
||||||
zipCode: integer('zipCode'),
|
// zipCode: integer('zipCode'),
|
||||||
county: varchar('county', { length: 255 }),
|
// county: varchar('county', { length: 255 }),
|
||||||
price: doublePrecision('price'),
|
price: doublePrecision('price'),
|
||||||
favoritesForUser: varchar('favoritesForUser', { length: 30 }).array(),
|
favoritesForUser: varchar('favoritesForUser', { length: 30 }).array(),
|
||||||
draft: boolean('draft'),
|
draft: boolean('draft'),
|
||||||
|
|
@ -62,8 +62,6 @@ export const businesses = pgTable('businesses', {
|
||||||
imageName: varchar('imageName', { length: 200 }),
|
imageName: varchar('imageName', { length: 200 }),
|
||||||
created: timestamp('created'),
|
created: timestamp('created'),
|
||||||
updated: timestamp('updated'),
|
updated: timestamp('updated'),
|
||||||
visits: integer('visits'),
|
|
||||||
lastVisit: timestamp('lastVisit'),
|
|
||||||
latitude: doublePrecision('latitude'),
|
latitude: doublePrecision('latitude'),
|
||||||
longitude: doublePrecision('longitude'),
|
longitude: doublePrecision('longitude'),
|
||||||
// embedding: vector('embedding', { dimensions: 1536 }),
|
// embedding: vector('embedding', { dimensions: 1536 }),
|
||||||
|
|
@ -82,14 +80,12 @@ export const commercials = pgTable('commercials', {
|
||||||
favoritesForUser: varchar('favoritesForUser', { length: 30 }).array(),
|
favoritesForUser: varchar('favoritesForUser', { length: 30 }).array(),
|
||||||
listingsCategory: listingsCategoryEnum('listingsCategory'), //listingsCategory: varchar('listingsCategory', { length: 255 }),
|
listingsCategory: listingsCategoryEnum('listingsCategory'), //listingsCategory: varchar('listingsCategory', { length: 255 }),
|
||||||
draft: boolean('draft'),
|
draft: boolean('draft'),
|
||||||
zipCode: integer('zipCode'),
|
// zipCode: integer('zipCode'),
|
||||||
county: varchar('county', { length: 255 }),
|
// county: varchar('county', { length: 255 }),
|
||||||
imageOrder: varchar('imageOrder', { length: 200 }).array(),
|
imageOrder: varchar('imageOrder', { length: 200 }).array(),
|
||||||
imagePath: varchar('imagePath', { length: 200 }),
|
imagePath: varchar('imagePath', { length: 200 }),
|
||||||
created: timestamp('created'),
|
created: timestamp('created'),
|
||||||
updated: timestamp('updated'),
|
updated: timestamp('updated'),
|
||||||
visits: integer('visits'),
|
|
||||||
lastVisit: timestamp('lastVisit'),
|
|
||||||
latitude: doublePrecision('latitude'),
|
latitude: doublePrecision('latitude'),
|
||||||
longitude: doublePrecision('longitude'),
|
longitude: doublePrecision('longitude'),
|
||||||
// embedding: vector('embedding', { dimensions: 1536 }),
|
// embedding: vector('embedding', { dimensions: 1536 }),
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,15 @@ import { FileService } from '../file/file.service.js';
|
||||||
import { GeoService } from '../geo/geo.service.js';
|
import { GeoService } from '../geo/geo.service.js';
|
||||||
import { BusinessListing, BusinessListingSchema } from '../models/db.model.js';
|
import { BusinessListing, BusinessListingSchema } from '../models/db.model.js';
|
||||||
import { BusinessListingCriteria, emailToDirName, JwtUser } from '../models/main.model.js';
|
import { BusinessListingCriteria, emailToDirName, JwtUser } from '../models/main.model.js';
|
||||||
import { getDistanceQuery } from '../utils.js';
|
import { convertBusinessToDrizzleBusiness, convertDrizzleBusinessToBusiness, getDistanceQuery } from '../utils.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BusinessListingService {
|
export class BusinessListingService {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
@Inject(PG_CONNECTION) private conn: NodePgDatabase<typeof schema>,
|
@Inject(PG_CONNECTION) private conn: NodePgDatabase<typeof schema>,
|
||||||
private fileService: FileService,
|
private fileService?: FileService,
|
||||||
private geoService: GeoService,
|
private geoService?: GeoService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
private getWhereConditions(criteria: BusinessListingCriteria): SQL[] {
|
private getWhereConditions(criteria: BusinessListingCriteria): SQL[] {
|
||||||
|
|
@ -39,10 +39,6 @@ export class BusinessListingService {
|
||||||
whereConditions.push(eq(businesses.state, criteria.state));
|
whereConditions.push(eq(businesses.state, criteria.state));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (criteria.county) {
|
|
||||||
whereConditions.push(ilike(businesses.city, `%${criteria.county}%`)); // Assuming county is part of city, adjust if necessary
|
|
||||||
}
|
|
||||||
|
|
||||||
if (criteria.minPrice) {
|
if (criteria.minPrice) {
|
||||||
whereConditions.push(gte(businesses.price, criteria.minPrice));
|
whereConditions.push(gte(businesses.price, criteria.minPrice));
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +125,7 @@ export class BusinessListingService {
|
||||||
|
|
||||||
const data = await query;
|
const data = await query;
|
||||||
const totalCount = await this.getBusinessListingsCount(criteria);
|
const totalCount = await this.getBusinessListingsCount(criteria);
|
||||||
const results = data.map(r => r.business);
|
const results = data.map(r => r.business).map(r => convertDrizzleBusinessToBusiness(r));
|
||||||
return {
|
return {
|
||||||
results,
|
results,
|
||||||
totalCount,
|
totalCount,
|
||||||
|
|
@ -149,33 +145,39 @@ export class BusinessListingService {
|
||||||
const [{ value: totalCount }] = await countQuery;
|
const [{ value: totalCount }] = await countQuery;
|
||||||
return totalCount;
|
return totalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findBusinessesById(id: string, user: JwtUser): Promise<BusinessListing> {
|
async findBusinessesById(id: string, user: JwtUser): Promise<BusinessListing> {
|
||||||
let result = await this.conn
|
let result = await this.conn
|
||||||
.select()
|
.select()
|
||||||
.from(businesses)
|
.from(businesses)
|
||||||
.where(and(sql`${businesses.id} = ${id}`));
|
.where(and(sql`${businesses.id} = ${id}`));
|
||||||
result = result.filter(r => !r.draft || r.imageName === emailToDirName(user?.username) || user?.roles.includes('ADMIN'));
|
result = result.filter(r => !r.draft || r.imageName === emailToDirName(user?.username) || user?.roles.includes('ADMIN'));
|
||||||
return result[0] as BusinessListing;
|
return convertDrizzleBusinessToBusiness(result[0]) as BusinessListing;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findBusinessesByEmail(email: string, user: JwtUser): Promise<BusinessListing[]> {
|
async findBusinessesByEmail(email: string, user: JwtUser): Promise<BusinessListing[]> {
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
conditions.push(eq(businesses.imageName, emailToDirName(email)));
|
conditions.push(eq(businesses.imageName, emailToDirName(email)));
|
||||||
if (email !== user?.username && (!user?.roles?.includes('ADMIN') ?? false)) {
|
if (email !== user?.username && (!user?.roles?.includes('ADMIN') ?? false)) {
|
||||||
conditions.push(ne(businesses.draft, true));
|
conditions.push(ne(businesses.draft, true));
|
||||||
}
|
}
|
||||||
return (await this.conn
|
const listings = (await this.conn
|
||||||
.select()
|
.select()
|
||||||
.from(businesses)
|
.from(businesses)
|
||||||
.where(and(...conditions))) as BusinessListing[];
|
.where(and(...conditions))) as BusinessListing[];
|
||||||
|
|
||||||
|
return listings.map(l => convertDrizzleBusinessToBusiness(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
// #### CREATE ########################################
|
// #### CREATE ########################################
|
||||||
async createListing(data: BusinessListing): Promise<BusinessListing> {
|
async createListing(data: BusinessListing): Promise<BusinessListing> {
|
||||||
try {
|
try {
|
||||||
data.created = new Date();
|
data.created = data.created ? (typeof data.created === 'string' ? new Date(data.created) : data.created) : new Date();
|
||||||
data.updated = new Date();
|
data.updated = new Date();
|
||||||
const validatedBusinessListing = BusinessListingSchema.parse(data);
|
const validatedBusinessListing = BusinessListingSchema.parse(data);
|
||||||
const [createdListing] = await this.conn.insert(businesses).values(validatedBusinessListing).returning();
|
const convertedBusinessListing = convertBusinessToDrizzleBusiness(data);
|
||||||
return createdListing as BusinessListing;
|
const [createdListing] = await this.conn.insert(businesses).values(convertedBusinessListing).returning();
|
||||||
|
return convertDrizzleBusinessToBusiness(createdListing);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof ZodError) {
|
if (error instanceof ZodError) {
|
||||||
const formattedErrors = error.errors.map(err => ({
|
const formattedErrors = error.errors.map(err => ({
|
||||||
|
|
@ -191,10 +193,11 @@ export class BusinessListingService {
|
||||||
async updateBusinessListing(id: string, data: BusinessListing): Promise<BusinessListing> {
|
async updateBusinessListing(id: string, data: BusinessListing): Promise<BusinessListing> {
|
||||||
try {
|
try {
|
||||||
data.updated = new Date();
|
data.updated = new Date();
|
||||||
data.created = new Date(data.created);
|
data.created = data.created ? (typeof data.created === 'string' ? new Date(data.created) : data.created) : new Date();
|
||||||
const validatedBusinessListing = BusinessListingSchema.parse(data);
|
const validatedBusinessListing = BusinessListingSchema.parse(data);
|
||||||
const [updateListing] = await this.conn.update(businesses).set(data).where(eq(businesses.id, id)).returning();
|
const convertedBusinessListing = convertBusinessToDrizzleBusiness(data);
|
||||||
return updateListing as BusinessListing;
|
const [updateListing] = await this.conn.update(businesses).set(convertedBusinessListing).where(eq(businesses.id, id)).returning();
|
||||||
|
return convertDrizzleBusinessToBusiness(updateListing);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof ZodError) {
|
if (error instanceof ZodError) {
|
||||||
const formattedErrors = error.errors.map(err => ({
|
const formattedErrors = error.errors.map(err => ({
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Request, UseGuards } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Request, UseGuards } from '@nestjs/common';
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
|
import { BusinessListing } from 'src/models/db.model.js';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
import { OptionalJwtAuthGuard } from '../jwt-auth/optional-jwt-auth.guard.js';
|
import { OptionalJwtAuthGuard } from '../jwt-auth/optional-jwt-auth.guard.js';
|
||||||
import { BusinessListingCriteria, JwtUser } from '../models/main.model.js';
|
import { BusinessListingCriteria, JwtUser } from '../models/main.model.js';
|
||||||
|
|
@ -20,7 +21,7 @@ export class BusinessListingsController {
|
||||||
|
|
||||||
@UseGuards(OptionalJwtAuthGuard)
|
@UseGuards(OptionalJwtAuthGuard)
|
||||||
@Get('user/:userid')
|
@Get('user/:userid')
|
||||||
findByUserId(@Request() req, @Param('userid') userid: string): any {
|
findByUserId(@Request() req, @Param('userid') userid: string): Promise<BusinessListing[]> {
|
||||||
return this.listingsService.findBusinessesByEmail(userid, req.user as JwtUser);
|
return this.listingsService.findBusinessesByEmail(userid, req.user as JwtUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,15 @@ import { FileService } from '../file/file.service.js';
|
||||||
import { GeoService } from '../geo/geo.service.js';
|
import { GeoService } from '../geo/geo.service.js';
|
||||||
import { CommercialPropertyListing, CommercialPropertyListingSchema } from '../models/db.model.js';
|
import { CommercialPropertyListing, CommercialPropertyListingSchema } from '../models/db.model.js';
|
||||||
import { CommercialPropertyListingCriteria, emailToDirName, JwtUser } from '../models/main.model.js';
|
import { CommercialPropertyListingCriteria, emailToDirName, JwtUser } from '../models/main.model.js';
|
||||||
import { getDistanceQuery } from '../utils.js';
|
import { convertCommercialToDrizzleCommercial, convertDrizzleCommercialToCommercial, getDistanceQuery } from '../utils.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CommercialPropertyService {
|
export class CommercialPropertyService {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
@Inject(PG_CONNECTION) private conn: NodePgDatabase<typeof schema>,
|
@Inject(PG_CONNECTION) private conn: NodePgDatabase<typeof schema>,
|
||||||
private fileService: FileService,
|
private fileService?: FileService,
|
||||||
private geoService: GeoService,
|
private geoService?: GeoService,
|
||||||
) {}
|
) {}
|
||||||
private getWhereConditions(criteria: CommercialPropertyListingCriteria): SQL[] {
|
private getWhereConditions(criteria: CommercialPropertyListingCriteria): SQL[] {
|
||||||
const whereConditions: SQL[] = [];
|
const whereConditions: SQL[] = [];
|
||||||
|
|
@ -38,10 +38,6 @@ export class CommercialPropertyService {
|
||||||
whereConditions.push(eq(schema.commercials.state, criteria.state));
|
whereConditions.push(eq(schema.commercials.state, criteria.state));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (criteria.county) {
|
|
||||||
whereConditions.push(ilike(schema.commercials.county, `%${criteria.county}%`));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (criteria.minPrice) {
|
if (criteria.minPrice) {
|
||||||
whereConditions.push(gte(schema.commercials.price, criteria.minPrice));
|
whereConditions.push(gte(schema.commercials.price, criteria.minPrice));
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +68,7 @@ export class CommercialPropertyService {
|
||||||
query.limit(length).offset(start);
|
query.limit(length).offset(start);
|
||||||
|
|
||||||
const data = await query;
|
const data = await query;
|
||||||
const results = data.map(r => r.commercial);
|
const results = data.map(r => r.commercial).map(r => convertDrizzleCommercialToCommercial(r));
|
||||||
const totalCount = await this.getCommercialPropertiesCount(criteria);
|
const totalCount = await this.getCommercialPropertiesCount(criteria);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -100,7 +96,7 @@ export class CommercialPropertyService {
|
||||||
.from(commercials)
|
.from(commercials)
|
||||||
.where(and(sql`${commercials.id} = ${id}`));
|
.where(and(sql`${commercials.id} = ${id}`));
|
||||||
result = result.filter(r => !r.draft || r.imagePath === emailToDirName(user?.username) || user?.roles.includes('ADMIN'));
|
result = result.filter(r => !r.draft || r.imagePath === emailToDirName(user?.username) || user?.roles.includes('ADMIN'));
|
||||||
return result[0] as CommercialPropertyListing;
|
return convertDrizzleCommercialToCommercial(result[0]) as CommercialPropertyListing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// #### Find by User EMail ########################################
|
// #### Find by User EMail ########################################
|
||||||
|
|
@ -110,10 +106,11 @@ export class CommercialPropertyService {
|
||||||
if (email !== user?.username && (!user?.roles?.includes('ADMIN') ?? false)) {
|
if (email !== user?.username && (!user?.roles?.includes('ADMIN') ?? false)) {
|
||||||
conditions.push(ne(commercials.draft, true));
|
conditions.push(ne(commercials.draft, true));
|
||||||
}
|
}
|
||||||
return (await this.conn
|
const listings = (await this.conn
|
||||||
.select()
|
.select()
|
||||||
.from(commercials)
|
.from(commercials)
|
||||||
.where(and(...conditions))) as CommercialPropertyListing[];
|
.where(and(...conditions))) as CommercialPropertyListing[];
|
||||||
|
return listings.map(l => convertDrizzleCommercialToCommercial(l)) as CommercialPropertyListing[];
|
||||||
}
|
}
|
||||||
// #### Find by imagePath ########################################
|
// #### Find by imagePath ########################################
|
||||||
async findByImagePath(imagePath: string, serial: string): Promise<CommercialPropertyListing> {
|
async findByImagePath(imagePath: string, serial: string): Promise<CommercialPropertyListing> {
|
||||||
|
|
@ -121,16 +118,17 @@ export class CommercialPropertyService {
|
||||||
.select()
|
.select()
|
||||||
.from(commercials)
|
.from(commercials)
|
||||||
.where(and(sql`${commercials.imagePath} = ${imagePath}`, sql`${commercials.serialId} = ${serial}`));
|
.where(and(sql`${commercials.imagePath} = ${imagePath}`, sql`${commercials.serialId} = ${serial}`));
|
||||||
return result[0] as CommercialPropertyListing;
|
return convertDrizzleCommercialToCommercial(result[0]) as CommercialPropertyListing;
|
||||||
}
|
}
|
||||||
// #### CREATE ########################################
|
// #### CREATE ########################################
|
||||||
async createListing(data: CommercialPropertyListing): Promise<CommercialPropertyListing> {
|
async createListing(data: CommercialPropertyListing): Promise<CommercialPropertyListing> {
|
||||||
try {
|
try {
|
||||||
data.created = new Date();
|
data.created = data.created ? (typeof data.created === 'string' ? new Date(data.created) : data.created) : new Date();
|
||||||
data.updated = new Date();
|
data.updated = new Date();
|
||||||
const validatedCommercialPropertyListing = CommercialPropertyListingSchema.parse(data);
|
const validatedCommercialPropertyListing = CommercialPropertyListingSchema.parse(data);
|
||||||
const [createdListing] = await this.conn.insert(commercials).values(validatedCommercialPropertyListing).returning();
|
const convertedCommercialPropertyListing = convertCommercialToDrizzleCommercial(data);
|
||||||
return createdListing as CommercialPropertyListing;
|
const [createdListing] = await this.conn.insert(commercials).values(convertedCommercialPropertyListing).returning();
|
||||||
|
return convertDrizzleCommercialToCommercial(createdListing);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof ZodError) {
|
if (error instanceof ZodError) {
|
||||||
const formattedErrors = error.errors.map(err => ({
|
const formattedErrors = error.errors.map(err => ({
|
||||||
|
|
@ -146,7 +144,7 @@ export class CommercialPropertyService {
|
||||||
async updateCommercialPropertyListing(id: string, data: CommercialPropertyListing): Promise<CommercialPropertyListing> {
|
async updateCommercialPropertyListing(id: string, data: CommercialPropertyListing): Promise<CommercialPropertyListing> {
|
||||||
try {
|
try {
|
||||||
data.updated = new Date();
|
data.updated = new Date();
|
||||||
data.created = new Date(data.created);
|
data.created = data.created ? (typeof data.created === 'string' ? new Date(data.created) : data.created) : new Date();
|
||||||
const validatedCommercialPropertyListing = CommercialPropertyListingSchema.parse(data);
|
const validatedCommercialPropertyListing = CommercialPropertyListingSchema.parse(data);
|
||||||
const imageOrder = await this.fileService.getPropertyImages(data.imagePath, String(data.serialId));
|
const imageOrder = await this.fileService.getPropertyImages(data.imagePath, String(data.serialId));
|
||||||
let difference = imageOrder.filter(x => !data.imageOrder.includes(x)).concat(data.imageOrder.filter(x => !imageOrder.includes(x)));
|
let difference = imageOrder.filter(x => !data.imageOrder.includes(x)).concat(data.imageOrder.filter(x => !imageOrder.includes(x)));
|
||||||
|
|
@ -154,8 +152,9 @@ export class CommercialPropertyService {
|
||||||
this.logger.warn(`changes between image directory and imageOrder in listing ${data.serialId}: ${difference.join(',')}`);
|
this.logger.warn(`changes between image directory and imageOrder in listing ${data.serialId}: ${difference.join(',')}`);
|
||||||
data.imageOrder = imageOrder;
|
data.imageOrder = imageOrder;
|
||||||
}
|
}
|
||||||
const [updateListing] = await this.conn.update(commercials).set(data).where(eq(commercials.id, id)).returning();
|
const convertedCommercialPropertyListing = convertCommercialToDrizzleCommercial(data);
|
||||||
return updateListing as CommercialPropertyListing;
|
const [updateListing] = await this.conn.update(commercials).set(convertedCommercialPropertyListing).where(eq(commercials.id, id)).returning();
|
||||||
|
return convertDrizzleCommercialToCommercial(updateListing);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof ZodError) {
|
if (error instanceof ZodError) {
|
||||||
const formattedErrors = error.errors.map(err => ({
|
const formattedErrors = error.errors.map(err => ({
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ const USStates = z.enum([
|
||||||
'CA',
|
'CA',
|
||||||
'CO',
|
'CO',
|
||||||
'CT',
|
'CT',
|
||||||
|
'DC',
|
||||||
'DE',
|
'DE',
|
||||||
'FL',
|
'FL',
|
||||||
'GA',
|
'GA',
|
||||||
|
|
@ -111,7 +112,9 @@ export const LicensedInSchema = z.object({
|
||||||
});
|
});
|
||||||
export const GeoSchema = z.object({
|
export const GeoSchema = z.object({
|
||||||
city: z.string(),
|
city: z.string(),
|
||||||
state: z.string(),
|
state: z.string().refine(val => USStates.safeParse(val).success, {
|
||||||
|
message: 'Invalid state. Must be a valid 2-letter US state code.',
|
||||||
|
}),
|
||||||
latitude: z.number().refine(
|
latitude: z.number().refine(
|
||||||
value => {
|
value => {
|
||||||
return value >= -90 && value <= 90;
|
return value >= -90 && value <= 90;
|
||||||
|
|
@ -142,7 +145,7 @@ export const UserSchema = z
|
||||||
companyName: z.string().optional().nullable(),
|
companyName: z.string().optional().nullable(),
|
||||||
companyOverview: z.string().optional().nullable(),
|
companyOverview: z.string().optional().nullable(),
|
||||||
companyWebsite: z.string().url({ message: 'Invalid URL format' }).optional().nullable(),
|
companyWebsite: z.string().url({ message: 'Invalid URL format' }).optional().nullable(),
|
||||||
companyLocation: GeoSchema,
|
companyLocation: GeoSchema.optional().nullable(),
|
||||||
offeredServices: z.string().optional().nullable(),
|
offeredServices: z.string().optional().nullable(),
|
||||||
areasServed: z.array(AreasServedSchema).optional().nullable(),
|
areasServed: z.array(AreasServedSchema).optional().nullable(),
|
||||||
hasProfile: z.boolean().optional().nullable(),
|
hasProfile: z.boolean().optional().nullable(),
|
||||||
|
|
@ -226,13 +229,8 @@ export const BusinessListingSchema = z.object({
|
||||||
}),
|
}),
|
||||||
title: z.string().min(10),
|
title: z.string().min(10),
|
||||||
description: z.string().min(10),
|
description: z.string().min(10),
|
||||||
city: z.string(),
|
location: GeoSchema,
|
||||||
state: z.string().refine(val => USStates.safeParse(val).success, {
|
price: z.number().positive().max(1000000000),
|
||||||
message: 'Invalid state. Must be a valid 2-letter US state code.',
|
|
||||||
}),
|
|
||||||
zipCode: z.number().int().positive().optional().nullable(),
|
|
||||||
county: z.string().optional().nullable(),
|
|
||||||
price: z.number().positive().max(100000000),
|
|
||||||
favoritesForUser: z.array(z.string()),
|
favoritesForUser: z.array(z.string()),
|
||||||
draft: z.boolean(),
|
draft: z.boolean(),
|
||||||
listingsCategory: ListingsCategoryEnum,
|
listingsCategory: ListingsCategoryEnum,
|
||||||
|
|
@ -251,24 +249,6 @@ export const BusinessListingSchema = z.object({
|
||||||
imageName: z.string().optional().nullable(),
|
imageName: z.string().optional().nullable(),
|
||||||
created: z.date(),
|
created: z.date(),
|
||||||
updated: z.date(),
|
updated: z.date(),
|
||||||
visits: z.number().int().positive().optional().nullable(),
|
|
||||||
lastVisit: z.date().optional().nullable(),
|
|
||||||
latitude: z.number().refine(
|
|
||||||
value => {
|
|
||||||
return value >= -90 && value <= 90;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: 'Latitude muss zwischen -90 und 90 liegen',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
longitude: z.number().refine(
|
|
||||||
value => {
|
|
||||||
return value >= -180 && value <= 180;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: 'Longitude muss zwischen -180 und 180 liegen',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
export type BusinessListing = z.infer<typeof BusinessListingSchema>;
|
export type BusinessListing = z.infer<typeof BusinessListingSchema>;
|
||||||
|
|
||||||
|
|
@ -277,44 +257,20 @@ export const CommercialPropertyListingSchema = z
|
||||||
id: z.string().uuid().optional().nullable(),
|
id: z.string().uuid().optional().nullable(),
|
||||||
serialId: z.number().int().positive().optional().nullable(),
|
serialId: z.number().int().positive().optional().nullable(),
|
||||||
email: z.string().email(),
|
email: z.string().email(),
|
||||||
//type: PropertyTypeEnum.optional(),
|
|
||||||
type: z.string().refine(val => PropertyTypeEnum.safeParse(val).success, {
|
type: z.string().refine(val => PropertyTypeEnum.safeParse(val).success, {
|
||||||
message: 'Invalid type. Must be one of: ' + PropertyTypeEnum.options.join(', '),
|
message: 'Invalid type. Must be one of: ' + PropertyTypeEnum.options.join(', '),
|
||||||
}),
|
}),
|
||||||
title: z.string().min(10),
|
title: z.string().min(10),
|
||||||
description: z.string().min(10),
|
description: z.string().min(10),
|
||||||
city: z.string(), // You might want to add a custom validation for valid US cities
|
location: GeoSchema,
|
||||||
state: z.string().refine(val => USStates.safeParse(val).success, {
|
price: z.number().positive().max(1000000000),
|
||||||
message: 'Invalid state. Must be a valid 2-letter US state code.',
|
|
||||||
}), // You might want to add a custom validation for valid US states
|
|
||||||
price: z.number().positive().max(100000000),
|
|
||||||
favoritesForUser: z.array(z.string()),
|
favoritesForUser: z.array(z.string()),
|
||||||
listingsCategory: ListingsCategoryEnum,
|
listingsCategory: ListingsCategoryEnum,
|
||||||
draft: z.boolean(),
|
draft: z.boolean(),
|
||||||
zipCode: z.number().int().positive().nullable().optional(), // You might want to add a custom validation for valid US zip codes
|
|
||||||
county: z.string().nullable().optional(), // You might want to add a custom validation for valid US counties
|
|
||||||
imageOrder: z.array(z.string()),
|
imageOrder: z.array(z.string()),
|
||||||
imagePath: z.string().nullable().optional(),
|
imagePath: z.string().nullable().optional(),
|
||||||
created: z.date(),
|
created: z.date(),
|
||||||
updated: z.date(),
|
updated: z.date(),
|
||||||
visits: z.number().int().positive().nullable().optional(),
|
|
||||||
lastVisit: z.date().nullable().optional(),
|
|
||||||
latitude: z.number().refine(
|
|
||||||
value => {
|
|
||||||
return value >= -90 && value <= 90;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: 'Latitude muss zwischen -90 und 90 liegen',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
longitude: z.number().refine(
|
|
||||||
value => {
|
|
||||||
return value >= -180 && value <= 180;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
message: 'Longitude muss zwischen -180 und 180 liegen',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
})
|
})
|
||||||
.strict();
|
.strict();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ export interface ListCriteria {
|
||||||
criteriaType: 'business' | 'commercialProperty' | 'broker';
|
criteriaType: 'business' | 'commercialProperty' | 'broker';
|
||||||
}
|
}
|
||||||
export interface BusinessListingCriteria extends ListCriteria {
|
export interface BusinessListingCriteria extends ListCriteria {
|
||||||
county: string;
|
|
||||||
minPrice: number;
|
minPrice: number;
|
||||||
maxPrice: number;
|
maxPrice: number;
|
||||||
minRevenue: number;
|
minRevenue: number;
|
||||||
|
|
@ -86,7 +85,6 @@ export interface BusinessListingCriteria extends ListCriteria {
|
||||||
criteriaType: 'business';
|
criteriaType: 'business';
|
||||||
}
|
}
|
||||||
export interface CommercialPropertyListingCriteria extends ListCriteria {
|
export interface CommercialPropertyListingCriteria extends ListCriteria {
|
||||||
county: string;
|
|
||||||
minPrice: number;
|
minPrice: number;
|
||||||
maxPrice: number;
|
maxPrice: number;
|
||||||
title: string;
|
title: string;
|
||||||
|
|
@ -315,21 +313,14 @@ export function createDefaultCommercialPropertyListing(): CommercialPropertyList
|
||||||
type: null,
|
type: null,
|
||||||
title: null,
|
title: null,
|
||||||
description: null,
|
description: null,
|
||||||
city: null,
|
location: null,
|
||||||
state: null,
|
|
||||||
price: null,
|
price: null,
|
||||||
favoritesForUser: [],
|
favoritesForUser: [],
|
||||||
draft: false,
|
draft: false,
|
||||||
zipCode: null,
|
|
||||||
county: null,
|
|
||||||
imageOrder: [],
|
imageOrder: [],
|
||||||
imagePath: null,
|
imagePath: null,
|
||||||
created: null,
|
created: null,
|
||||||
updated: null,
|
updated: null,
|
||||||
visits: null,
|
|
||||||
lastVisit: null,
|
|
||||||
latitude: null,
|
|
||||||
longitude: null,
|
|
||||||
listingsCategory: 'commercialProperty',
|
listingsCategory: 'commercialProperty',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -340,8 +331,7 @@ export function createDefaultBusinessListing(): BusinessListing {
|
||||||
type: null,
|
type: null,
|
||||||
title: null,
|
title: null,
|
||||||
description: null,
|
description: null,
|
||||||
city: null,
|
location: null,
|
||||||
state: null,
|
|
||||||
price: null,
|
price: null,
|
||||||
favoritesForUser: [],
|
favoritesForUser: [],
|
||||||
draft: false,
|
draft: false,
|
||||||
|
|
@ -359,10 +349,6 @@ export function createDefaultBusinessListing(): BusinessListing {
|
||||||
internals: null,
|
internals: null,
|
||||||
created: null,
|
created: null,
|
||||||
updated: null,
|
updated: null,
|
||||||
visits: null,
|
|
||||||
lastVisit: null,
|
|
||||||
latitude: null,
|
|
||||||
longitude: null,
|
|
||||||
listingsCategory: 'business',
|
listingsCategory: 'business',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { sql } from 'drizzle-orm';
|
import { sql } from 'drizzle-orm';
|
||||||
import { businesses, commercials, users } from './drizzle/schema.js';
|
import { businesses, commercials, users } from './drizzle/schema.js';
|
||||||
import { User } from './models/db.model.js';
|
import { BusinessListing, CommercialPropertyListing, User } from './models/db.model.js';
|
||||||
export const EARTH_RADIUS_KM = 6371; // Erdradius in Kilometern
|
export const EARTH_RADIUS_KM = 6371; // Erdradius in Kilometern
|
||||||
export const EARTH_RADIUS_MILES = 3959; // Erdradius in Meilen
|
export const EARTH_RADIUS_MILES = 3959; // Erdradius in Meilen
|
||||||
export function convertStringToNullUndefined(value) {
|
export function convertStringToNullUndefined(value) {
|
||||||
|
|
@ -29,8 +29,43 @@ export const getDistanceQuery = (schema: typeof businesses | typeof commercials
|
||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DrizzleUser = typeof users.$inferSelect; //Partial<InferInsertModel<typeof users>>;
|
type DrizzleUser = typeof users.$inferSelect;
|
||||||
|
type DrizzleBusinessListing = typeof businesses.$inferSelect;
|
||||||
|
type DrizzleCommercialPropertyListing = typeof commercials.$inferSelect;
|
||||||
|
export function convertBusinessToDrizzleBusiness(businessListing: Partial<BusinessListing>): DrizzleBusinessListing {
|
||||||
|
return flattenObject(businessListing);
|
||||||
|
}
|
||||||
|
export function convertDrizzleBusinessToBusiness(drizzleBusinessListing: Partial<DrizzleBusinessListing>): BusinessListing {
|
||||||
|
const o = {
|
||||||
|
location_city: drizzleBusinessListing.city,
|
||||||
|
location_state: drizzleBusinessListing.state,
|
||||||
|
location_latitude: drizzleBusinessListing.latitude,
|
||||||
|
location_longitude: drizzleBusinessListing.longitude,
|
||||||
|
...drizzleBusinessListing,
|
||||||
|
};
|
||||||
|
delete o.city;
|
||||||
|
delete o.state;
|
||||||
|
delete o.latitude;
|
||||||
|
delete o.longitude;
|
||||||
|
return unflattenObject(o);
|
||||||
|
}
|
||||||
|
export function convertCommercialToDrizzleCommercial(commercialPropertyListing: Partial<CommercialPropertyListing>): DrizzleCommercialPropertyListing {
|
||||||
|
return flattenObject(commercialPropertyListing);
|
||||||
|
}
|
||||||
|
export function convertDrizzleCommercialToCommercial(drizzleCommercialPropertyListing: Partial<DrizzleCommercialPropertyListing>): CommercialPropertyListing {
|
||||||
|
const o = {
|
||||||
|
location_city: drizzleCommercialPropertyListing.city,
|
||||||
|
location_state: drizzleCommercialPropertyListing.state,
|
||||||
|
location_latitude: drizzleCommercialPropertyListing.latitude,
|
||||||
|
location_longitude: drizzleCommercialPropertyListing.longitude,
|
||||||
|
...drizzleCommercialPropertyListing,
|
||||||
|
};
|
||||||
|
delete o.city;
|
||||||
|
delete o.state;
|
||||||
|
delete o.latitude;
|
||||||
|
delete o.longitude;
|
||||||
|
return unflattenObject(o);
|
||||||
|
}
|
||||||
export function convertUserToDrizzleUser(user: Partial<User>): DrizzleUser {
|
export function convertUserToDrizzleUser(user: Partial<User>): DrizzleUser {
|
||||||
const { companyLocation, ...restUser } = user;
|
const { companyLocation, ...restUser } = user;
|
||||||
|
|
||||||
|
|
@ -96,3 +131,42 @@ export function convertDrizzleUserToUser(drizzleUser: Partial<DrizzleUser>): Use
|
||||||
};
|
};
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
function flattenObject(obj: any, res: any = {}): any {
|
||||||
|
for (const key in obj) {
|
||||||
|
if (obj.hasOwnProperty(key)) {
|
||||||
|
const value = obj[key];
|
||||||
|
|
||||||
|
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
||||||
|
if (value instanceof Date) {
|
||||||
|
res[key] = value;
|
||||||
|
} else {
|
||||||
|
flattenObject(value, res);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
function unflattenObject(obj: any, separator: string = '_'): any {
|
||||||
|
const result: any = {};
|
||||||
|
|
||||||
|
for (const key in obj) {
|
||||||
|
if (obj.hasOwnProperty(key)) {
|
||||||
|
const keys = key.split(separator);
|
||||||
|
keys.reduce((acc, curr, idx) => {
|
||||||
|
if (idx === keys.length - 1) {
|
||||||
|
acc[curr] = obj[key];
|
||||||
|
} else {
|
||||||
|
if (!acc[curr]) {
|
||||||
|
acc[curr] = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return acc[curr];
|
||||||
|
}, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ export class DetailsBusinessListingComponent {
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
{ label: 'Category', value: this.selectOptions.getBusiness(this.listing.type) },
|
{ label: 'Category', value: this.selectOptions.getBusiness(this.listing.type) },
|
||||||
{ label: 'Located in', value: `${this.listing.city}, ${this.selectOptions.getState(this.listing.state)}` },
|
{ label: 'Located in', value: `${this.listing.location.city}, ${this.selectOptions.getState(this.listing.location.state)}` },
|
||||||
{ label: 'Asking Price', value: `$${this.listing.price?.toLocaleString()}` },
|
{ label: 'Asking Price', value: `$${this.listing.price?.toLocaleString()}` },
|
||||||
{ label: 'Sales revenue', value: `$${this.listing.salesRevenue?.toLocaleString()}` },
|
{ label: 'Sales revenue', value: `$${this.listing.salesRevenue?.toLocaleString()}` },
|
||||||
{ label: 'Cash flow', value: `$${this.listing.cashFlow?.toLocaleString()}` },
|
{ label: 'Cash flow', value: `$${this.listing.cashFlow?.toLocaleString()}` },
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,8 @@ export class DetailsCommercialPropertyListingComponent {
|
||||||
});
|
});
|
||||||
this.propertyDetails = [
|
this.propertyDetails = [
|
||||||
{ label: 'Property Category', value: this.selectOptions.getCommercialProperty(this.listing.type) },
|
{ label: 'Property Category', value: this.selectOptions.getCommercialProperty(this.listing.type) },
|
||||||
{ label: 'Located in', value: this.selectOptions.getState(this.listing.state) },
|
{ label: 'Located in', value: this.selectOptions.getState(this.listing.location.state) },
|
||||||
{ label: 'City', value: this.listing.city },
|
{ label: 'City', value: this.listing.location.city },
|
||||||
{ label: 'Zip Code', value: this.listing.zipCode },
|
|
||||||
{ label: 'County', value: this.listing.county },
|
|
||||||
{ label: 'Asking Price:', value: `$${this.listing.price?.toLocaleString()}` },
|
{ label: 'Asking Price:', value: `$${this.listing.price?.toLocaleString()}` },
|
||||||
];
|
];
|
||||||
//this.initFlowbite();
|
//this.initFlowbite();
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
<p class="text-sm text-gray-600 mb-1">Asking price: {{ listing.price | currency }}</p>
|
<p class="text-sm text-gray-600 mb-1">Asking price: {{ listing.price | currency }}</p>
|
||||||
<p class="text-sm text-gray-600 mb-1">Sales revenue: {{ listing.salesRevenue | currency }}</p>
|
<p class="text-sm text-gray-600 mb-1">Sales revenue: {{ listing.salesRevenue | currency }}</p>
|
||||||
<p class="text-sm text-gray-600 mb-1">Net profit: {{ listing.cashFlow | currency }}</p>
|
<p class="text-sm text-gray-600 mb-1">Net profit: {{ listing.cashFlow | currency }}</p>
|
||||||
<p class="text-sm text-gray-600 mb-1">Location: {{ listing.city }} - {{ selectOptions.getState(listing.state) }}</p>
|
<p class="text-sm text-gray-600 mb-1">Location: {{ listing.location.city }} - {{ listing.location.state }}</p>
|
||||||
<p class="text-sm text-gray-600 mb-1">Established: {{ listing.established }}</p>
|
<p class="text-sm text-gray-600 mb-1">Established: {{ listing.established }}</p>
|
||||||
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}" alt="Company logo" class="absolute bottom-[70px] right-[30px] h-[35px] w-auto" />
|
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}" alt="Company logo" class="absolute bottom-[70px] right-[30px] h-[35px] w-auto" />
|
||||||
<div class="flex-grow"></div>
|
<div class="flex-grow"></div>
|
||||||
|
|
|
||||||
|
|
@ -1,60 +1,5 @@
|
||||||
<!--
|
|
||||||
<div class="surface-200 h-full">
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="grid">
|
|
||||||
@for (listing of listings; track listing.id) {
|
|
||||||
<div class="col-12 xl:col-4 flex">
|
|
||||||
<div class="surface-card p-2 flex flex-column flex-grow-1 justify-content-between" style="border-radius: 10px">
|
|
||||||
<article class="flex flex-column md:flex-row w-full gap-3 p-3 surface-card">
|
|
||||||
<div class="relative">
|
|
||||||
@if (listing.imageOrder?.length>0){
|
|
||||||
<img
|
|
||||||
src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.serialId }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}"
|
|
||||||
alt="Image"
|
|
||||||
class="border-round w-full h-full md:w-12rem md:h-9rem"
|
|
||||||
/>
|
|
||||||
} @else {
|
|
||||||
<img src="assets/images/placeholder_properties.jpg" alt="Image" class="border-round w-full h-full md:w-12rem md:h-9rem" />
|
|
||||||
}
|
|
||||||
<p class="absolute px-2 py-1 border-round-lg text-sm font-normal text-white mt-0 mb-0" style="background-color: rgba(255, 255, 255, 0.3); backdrop-filter: invert(30%); top: 3%; left: 3%">
|
|
||||||
{{ selectOptions.getState(listing.state) }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-column w-full gap-3">
|
|
||||||
<div class="flex w-full justify-content-between align-items-center flex-wrap gap-3">
|
|
||||||
<p class="font-semibold text-lg mt-0 mb-0">{{ listing.title }}</p>
|
|
||||||
</div>
|
|
||||||
<p class="font-normal text-lg text-600 mt-0 mb-0">{{ listing.city }}</p>
|
|
||||||
<div class="flex flex-wrap justify-content-between xl:h-2rem mt-auto">
|
|
||||||
<p class="text-base flex align-items-center text-900 mt-0 mb-1">
|
|
||||||
<i class="pi pi-list mr-2"></i>
|
|
||||||
<span class="font-medium">{{ selectOptions.getCommercialProperty(listing.type) }}</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<p class="font-semibold text-3xl text-900 mt-0 mb-2">{{ listing.price | currency }}</p>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
<div class="px-4 py-3 text-left">
|
|
||||||
<button
|
|
||||||
pButton
|
|
||||||
pRipple
|
|
||||||
icon="pi pi-arrow-right"
|
|
||||||
iconPos="right"
|
|
||||||
label="View Full Listing"
|
|
||||||
class="p-button-rounded p-button-success"
|
|
||||||
[routerLink]="['/details-commercial-property-listing', listing.id]"
|
|
||||||
></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<div class="container mx-auto px-4 py-8">
|
<div class="container mx-auto px-4 py-8">
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
<!-- Property Card 1 -->
|
|
||||||
@for (listing of listings; track listing.id) {
|
@for (listing of listings; track listing.id) {
|
||||||
<div class="bg-white rounded-lg shadow-md overflow-hidden">
|
<div class="bg-white rounded-lg shadow-md overflow-hidden">
|
||||||
@if (listing.imageOrder?.length>0){
|
@if (listing.imageOrder?.length>0){
|
||||||
|
|
@ -64,11 +9,11 @@
|
||||||
}
|
}
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<div class="flex items-center justify-between mb-2">
|
<div class="flex items-center justify-between mb-2">
|
||||||
<span class="bg-gray-200 text-gray-700 text-xs font-semibold px-2 py-1 rounded">{{ selectOptions.getState(listing.state) }}</span>
|
<span class="bg-gray-200 text-gray-700 text-xs font-semibold px-2 py-1 rounded">{{ selectOptions.getState(listing.location.state) }}</span>
|
||||||
<span class="text-gray-600 text-sm"><i [class]="selectOptions.getIconTypeOfCommercials(listing.type)" class="mr-1"></i> {{ selectOptions.getCommercialProperty(listing.type) }}</span>
|
<span class="text-gray-600 text-sm"><i [class]="selectOptions.getIconTypeOfCommercials(listing.type)" class="mr-1"></i> {{ selectOptions.getCommercialProperty(listing.type) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="text-lg font-semibold mb-2">{{ listing.title }}</h3>
|
<h3 class="text-lg font-semibold mb-2">{{ listing.title }}</h3>
|
||||||
<p class="text-gray-600 mb-2">{{ listing.city }}</p>
|
<p class="text-gray-600 mb-2">{{ listing.location.city }}</p>
|
||||||
<p class="text-xl font-bold mb-4">{{ listing.price | currency }}</p>
|
<p class="text-xl font-bold mb-4">{{ listing.price | currency }}</p>
|
||||||
<button [routerLink]="['/details-commercial-property-listing', listing.id]" class="bg-green-500 text-white px-4 py-2 rounded-full w-full hover:bg-green-600 transition duration-300">
|
<button [routerLink]="['/details-commercial-property-listing', listing.id]" class="bg-green-500 text-white px-4 py-2 rounded-full w-full hover:bg-green-600 transition duration-300">
|
||||||
View Full Listing <i class="fas fa-arrow-right ml-1"></i>
|
View Full Listing <i class="fas fa-arrow-right ml-1"></i>
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<app-validated-ng-select label="State" name="state" [(ngModel)]="listing.state" [items]="selectOptions?.states"></app-validated-ng-select>
|
<app-validated-ng-select label="State" name="state" [(ngModel)]="listing.location.state" [items]="selectOptions?.states"></app-validated-ng-select>
|
||||||
<app-validated-input label="City" name="city" [(ngModel)]="listing.city"></app-validated-input>
|
<app-validated-input label="City" name="city" [(ngModel)]="listing.location.city"></app-validated-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="flex mb-4 space-x-4">
|
<!-- <div class="flex mb-4 space-x-4">
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ export class EditBusinessListingComponent {
|
||||||
suggestions: string[] | undefined;
|
suggestions: string[] | undefined;
|
||||||
|
|
||||||
async search(event: AutoCompleteCompleteEvent) {
|
async search(event: AutoCompleteCompleteEvent) {
|
||||||
const result = await lastValueFrom(this.geoService.findCitiesStartingWith(event.query, this.listing.state));
|
const result = await lastValueFrom(this.geoService.findCitiesStartingWith(event.query));
|
||||||
this.suggestions = result.map(r => r.city).slice(0, 5);
|
this.suggestions = result.map(r => r.city).slice(0, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<app-validated-ng-select label="State" name="state" [(ngModel)]="listing.state" [items]="selectOptions?.states"></app-validated-ng-select>
|
<app-validated-ng-select label="State" name="state" [(ngModel)]="listing.location.state" [items]="selectOptions?.states"></app-validated-ng-select>
|
||||||
<app-validated-input label="City" name="city" [(ngModel)]="listing.city"></app-validated-input>
|
<app-validated-input label="City" name="city" [(ngModel)]="listing.location.city"></app-validated-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="flex mb-4 space-x-4">
|
<!-- <div class="flex mb-4 space-x-4">
|
||||||
|
|
@ -64,10 +64,10 @@
|
||||||
<input type="text" id="county" [(ngModel)]="listing.county" name="county" class="w-full p-2 border border-gray-300 rounded-md" />
|
<input type="text" id="county" [(ngModel)]="listing.county" name="county" class="w-full p-2 border border-gray-300 rounded-md" />
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<!-- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<app-validated-input label="Zip Code" name="zipCode" [(ngModel)]="listing.zipCode"></app-validated-input>
|
<app-validated-input label="Zip Code" name="zipCode" [(ngModel)]="listing.zipCode"></app-validated-input>
|
||||||
<app-validated-input label="County" name="county" [(ngModel)]="listing.county"></app-validated-input>
|
<app-validated-input label="County" name="county" [(ngModel)]="listing.county"></app-validated-input>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<!-- <div class="mb-4">
|
<!-- <div class="mb-4">
|
||||||
<label for="internals" class="block text-sm font-bold text-gray-700 mb-1">Internal Notes (Will not be shown on the listing, for your records only.)</label>
|
<label for="internals" class="block text-sm font-bold text-gray-700 mb-1">Internal Notes (Will not be shown on the listing, for your records only.)</label>
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ export class EditCommercialPropertyListingComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
async search(event: AutoCompleteCompleteEvent) {
|
async search(event: AutoCompleteCompleteEvent) {
|
||||||
const result = await lastValueFrom(this.geoService.findCitiesStartingWith(event.query, this.listing.state));
|
const result = await lastValueFrom(this.geoService.findCitiesStartingWith(event.query));
|
||||||
this.suggestions = result.map(r => r.city).slice(0, 5);
|
this.suggestions = result.map(r => r.city).slice(0, 5);
|
||||||
}
|
}
|
||||||
openFileDialog() {
|
openFileDialog() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<tr *ngFor="let listing of myListings" class="border-b">
|
<tr *ngFor="let listing of myListings" class="border-b">
|
||||||
<td class="py-2 px-4">{{ listing.title }}</td>
|
<td class="py-2 px-4">{{ listing.title }}</td>
|
||||||
<td class="py-2 px-4">{{ listing.listingsCategory === 'commercialProperty' ? 'Commercial Property' : 'Business' }}</td>
|
<td class="py-2 px-4">{{ listing.listingsCategory === 'commercialProperty' ? 'Commercial Property' : 'Business' }}</td>
|
||||||
<td class="py-2 px-4">{{ listing.state }}</td>
|
<td class="py-2 px-4">{{ listing.location.state }}</td>
|
||||||
<td class="py-2 px-4">
|
<td class="py-2 px-4">
|
||||||
@if(listing.listingsCategory==='business'){
|
@if(listing.listingsCategory==='business'){
|
||||||
<button class="bg-green-500 text-white p-2 rounded-full mr-2" [routerLink]="['/editBusinessListing', listing.id]">
|
<button class="bg-green-500 text-white p-2 rounded-full mr-2" [routerLink]="['/editBusinessListing', listing.id]">
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
<div *ngFor="let listing of myListings" class="bg-white shadow-md rounded-lg p-4 mb-4">
|
<div *ngFor="let listing of myListings" class="bg-white shadow-md rounded-lg p-4 mb-4">
|
||||||
<h2 class="text-xl font-semibold mb-2">{{ listing.title }}</h2>
|
<h2 class="text-xl font-semibold mb-2">{{ listing.title }}</h2>
|
||||||
<p class="text-gray-600 mb-2">Category: {{ listing.listingsCategory === 'commercialProperty' ? 'Commercial Property' : 'Business' }}</p>
|
<p class="text-gray-600 mb-2">Category: {{ listing.listingsCategory === 'commercialProperty' ? 'Commercial Property' : 'Business' }}</p>
|
||||||
<p class="text-gray-600 mb-4">Located in: {{ listing.state }}</p>
|
<p class="text-gray-600 mb-4">Located in: {{ listing.location.city }} - {{ listing.location.state }}</p>
|
||||||
<div class="flex justify-end">
|
<div class="flex justify-end">
|
||||||
<button class="bg-green-500 text-white p-2 rounded-full mr-2">
|
<button class="bg-green-500 text-white p-2 rounded-full mr-2">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ export function createEmptyBusinessListingCriteria(): BusinessListingCriteria {
|
||||||
types: [],
|
types: [],
|
||||||
prompt: '',
|
prompt: '',
|
||||||
criteriaType: 'business',
|
criteriaType: 'business',
|
||||||
county: '',
|
|
||||||
minPrice: null,
|
minPrice: null,
|
||||||
maxPrice: null,
|
maxPrice: null,
|
||||||
minRevenue: null,
|
minRevenue: null,
|
||||||
|
|
@ -129,7 +128,6 @@ export function createEmptyCommercialPropertyListingCriteria(): CommercialProper
|
||||||
types: [],
|
types: [],
|
||||||
prompt: '',
|
prompt: '',
|
||||||
criteriaType: 'commercialProperty',
|
criteriaType: 'commercialProperty',
|
||||||
county: '',
|
|
||||||
minPrice: null,
|
minPrice: null,
|
||||||
maxPrice: null,
|
maxPrice: null,
|
||||||
title: '',
|
title: '',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue