From aff55c54333f2611b364068e6c57cf850396f4a8 Mon Sep 17 00:00:00 2001
From: Andreas Knuth
Date: Mon, 13 May 2024 17:31:01 -0500
Subject: [PATCH] BugFixes image upload, image display, new DB structure for
areasServed, licenedIn
---
bizmatch-server/src/drizzle/import.ts | 40 +-
...r_dave.sql => 0000_open_hannibal_king.sql} | 14 +-
.../migrations/0001_charming_thundra.sql | 2 +
.../0001_rapid_daimon_hellstrom.sql | 1 -
.../migrations/0002_black_zaladane.sql | 7 -
.../migrations/0003_tough_hobgoblin.sql | 1 -
.../migrations/meta/0000_snapshot.json | 30 +-
.../migrations/meta/0001_snapshot.json | 42 +-
.../migrations/meta/0002_snapshot.json | 474 -----------------
.../migrations/meta/0003_snapshot.json | 480 ------------------
.../src/drizzle/migrations/meta/_journal.json | 22 +-
bizmatch-server/src/drizzle/schema.ts | 9 +-
bizmatch-server/src/image/image.controller.ts | 4 +-
.../listings/unknown-listings.controller.ts | 28 +-
.../src/mail/templates/inquiry.hbs | 15 +-
bizmatch-server/src/models/db.model.ts | 32 +-
bizmatch-server/src/user/user.service.ts | 8 +-
bizmatch/package.json | 2 +-
bizmatch/src/app/app.routes.ts | 5 +
...commercial-property-listing.component.html | 18 +-
.../details-user/details-user.component.html | 16 +-
.../details-user/details-user.component.ts | 8 +-
.../broker-listings.component.html | 6 +-
.../broker-listings.component.ts | 5 +-
.../business-listings.component.html | 8 +-
.../business-listings.component.scss | 8 +-
.../business-listings.component.ts | 5 +-
...ommercial-property-listings.component.html | 2 +-
...ommercial-property-listings.component.scss | 34 +-
.../commercial-property-listings.component.ts | 6 +-
bizmatch/src/app/pages/pages.scss | 20 +-
.../account/account.component.html | 38 +-
.../subscription/account/account.component.ts | 53 +-
.../edit-business-listing.component.html | 14 +-
34 files changed, 326 insertions(+), 1131 deletions(-)
rename bizmatch-server/src/drizzle/migrations/{0000_third_spacker_dave.sql => 0000_open_hannibal_king.sql} (89%)
create mode 100644 bizmatch-server/src/drizzle/migrations/0001_charming_thundra.sql
delete mode 100644 bizmatch-server/src/drizzle/migrations/0001_rapid_daimon_hellstrom.sql
delete mode 100644 bizmatch-server/src/drizzle/migrations/0002_black_zaladane.sql
delete mode 100644 bizmatch-server/src/drizzle/migrations/0003_tough_hobgoblin.sql
delete mode 100644 bizmatch-server/src/drizzle/migrations/meta/0002_snapshot.json
delete mode 100644 bizmatch-server/src/drizzle/migrations/meta/0003_snapshot.json
diff --git a/bizmatch-server/src/drizzle/import.ts b/bizmatch-server/src/drizzle/import.ts
index 1f3a744..422e27c 100644
--- a/bizmatch-server/src/drizzle/import.ts
+++ b/bizmatch-server/src/drizzle/import.ts
@@ -5,7 +5,7 @@ import { join } from 'path';
import pkg from 'pg';
import { rimraf } from 'rimraf';
import sharp from 'sharp';
-import { BusinessListing, CommercialPropertyListing, User } from 'src/models/db.model.js';
+import { BusinessListing, CommercialPropertyListing, User, UserData } from 'src/models/db.model.js';
import * as schema from './schema.js';
const { Pool } = pkg;
@@ -22,9 +22,9 @@ await db.delete(schema.users);
//Broker
let filePath = `./data/broker.json`;
let data: string = readFileSync(filePath, 'utf8');
-const userData: User[] = JSON.parse(data); // Erwartet ein Array von Objekten
+const usersData: UserData[] = JSON.parse(data); // Erwartet ein Array von Objekten
const generatedUserData = [];
-console.log(userData.length);
+console.log(usersData.length);
let i = 0,
male = 0,
female = 0;
@@ -32,11 +32,32 @@ const targetPathProfile = `./pictures/profile`;
deleteFilesOfDir(targetPathProfile);
const targetPathLogo = `./pictures/logo`;
deleteFilesOfDir(targetPathLogo);
-for (const user of userData) {
- delete user.id;
- user.licensedIn = user.licensedIn.map(l => `${l['name']}|${l['value']}`);
+for (const userData of usersData) {
+ const user: User = { firstname: '', lastname: '', email: '' };
+ user.licensedIn = [];
+ userData.licensedIn.forEach(l => {
+ console.log(l['value'], l['name']);
+ user.licensedIn.push({ registerNo: l['value'], state: l['name'] });
+ });
+ user.areasServed = [];
+ user.areasServed = userData.areasServed.map(l => {
+ return { county: l.split(',')[0].trim(), state: l.split(',')[1].trim() };
+ });
user.hasCompanyLogo = true;
user.hasProfile = true;
+ user.firstname = userData.firstname;
+ user.lastname = userData.lastname;
+ user.email = userData.email;
+ user.phoneNumber = userData.phoneNumber;
+ user.description = userData.description;
+ user.companyName = userData.companyName;
+ user.companyOverview = userData.companyOverview;
+ user.companyWebsite = userData.companyWebsite;
+ user.companyLocation = userData.companyLocation;
+ user.offeredServices = userData.offeredServices;
+ user.gender = userData.gender;
+ user.created = new Date();
+ user.updated = new Date();
const u = await db.insert(schema.users).values(user).returning({ insertedId: schema.users.id, gender: schema.users.gender });
generatedUserData.push(u[0].insertedId);
i++;
@@ -46,7 +67,7 @@ for (const user of userData) {
await storeProfilePicture(data, u[0].insertedId);
} else {
female++;
- const data = readFileSync(`./pictures/profile_base/Frau_${male}.jpg`);
+ const data = readFileSync(`./pictures/profile_base/Frau_${female}.jpg`);
await storeProfilePicture(data, u[0].insertedId);
}
const data = readFileSync(`./pictures/logos_base/${i}.jpg`);
@@ -60,6 +81,7 @@ const businessJsonData = JSON.parse(data) as BusinessListing[]; // Erwartet ein
for (const business of businessJsonData) {
delete business.id;
business.created = new Date(business.created);
+ business.updated = new Date(business.created);
business.userId = getRandomItem(generatedUserData);
await db.insert(schema.businesses).values(business);
}
@@ -73,7 +95,9 @@ for (const commercial of commercialJsonData) {
commercial.imageOrder = getFilenames(id);
commercial.imagePath = id;
- commercial.created = getRandomDateWithinLastYear();
+ const insertionDate = getRandomDateWithinLastYear();
+ commercial.created = insertionDate;
+ commercial.updated = insertionDate;
commercial.userId = getRandomItem(generatedUserData);
await db.insert(schema.commercials).values(commercial);
}
diff --git a/bizmatch-server/src/drizzle/migrations/0000_third_spacker_dave.sql b/bizmatch-server/src/drizzle/migrations/0000_open_hannibal_king.sql
similarity index 89%
rename from bizmatch-server/src/drizzle/migrations/0000_third_spacker_dave.sql
rename to bizmatch-server/src/drizzle/migrations/0000_open_hannibal_king.sql
index 4c9c7bf..def5616 100644
--- a/bizmatch-server/src/drizzle/migrations/0000_third_spacker_dave.sql
+++ b/bizmatch-server/src/drizzle/migrations/0000_open_hannibal_king.sql
@@ -1,3 +1,9 @@
+DO $$ BEGIN
+ CREATE TYPE "gender" AS ENUM('male', 'female');
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "businesses" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"userId" uuid,
@@ -38,6 +44,7 @@ CREATE TABLE IF NOT EXISTS "commercials" (
"state" char(2),
"price" double precision,
"favoritesForUser" varchar(30)[],
+ "listingsCategory" varchar(255),
"hideImage" boolean,
"draft" boolean,
"zipCode" integer,
@@ -45,7 +52,7 @@ CREATE TABLE IF NOT EXISTS "commercials" (
"email" varchar(255),
"website" varchar(255),
"phoneNumber" varchar(255),
- "imageOrder" varchar(30)[],
+ "imageOrder" varchar(200)[],
"imagePath" varchar(50),
"created" timestamp,
"updated" timestamp,
@@ -65,10 +72,11 @@ CREATE TABLE IF NOT EXISTS "users" (
"companyWebsite" varchar(255),
"companyLocation" varchar(255),
"offeredServices" text,
- "areasServed" varchar(100)[],
+ "areasServed" jsonb,
"hasProfile" boolean,
"hasCompanyLogo" boolean,
- "licensedIn" varchar(50)[]
+ "licensedIn" jsonb,
+ "gender" "gender"
);
--> statement-breakpoint
DO $$ BEGIN
diff --git a/bizmatch-server/src/drizzle/migrations/0001_charming_thundra.sql b/bizmatch-server/src/drizzle/migrations/0001_charming_thundra.sql
new file mode 100644
index 0000000..e211d48
--- /dev/null
+++ b/bizmatch-server/src/drizzle/migrations/0001_charming_thundra.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "users" ADD COLUMN "created" timestamp;--> statement-breakpoint
+ALTER TABLE "users" ADD COLUMN "updated" timestamp;
\ No newline at end of file
diff --git a/bizmatch-server/src/drizzle/migrations/0001_rapid_daimon_hellstrom.sql b/bizmatch-server/src/drizzle/migrations/0001_rapid_daimon_hellstrom.sql
deleted file mode 100644
index 6ccab12..0000000
--- a/bizmatch-server/src/drizzle/migrations/0001_rapid_daimon_hellstrom.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE "commercials" ALTER COLUMN "imageOrder" SET DATA TYPE varchar(200)[];
\ No newline at end of file
diff --git a/bizmatch-server/src/drizzle/migrations/0002_black_zaladane.sql b/bizmatch-server/src/drizzle/migrations/0002_black_zaladane.sql
deleted file mode 100644
index eda9b80..0000000
--- a/bizmatch-server/src/drizzle/migrations/0002_black_zaladane.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-DO $$ BEGIN
- CREATE TYPE "gender" AS ENUM('male', 'female');
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-ALTER TABLE "users" ADD COLUMN "gender" "gender";
\ No newline at end of file
diff --git a/bizmatch-server/src/drizzle/migrations/0003_tough_hobgoblin.sql b/bizmatch-server/src/drizzle/migrations/0003_tough_hobgoblin.sql
deleted file mode 100644
index 952bbdd..0000000
--- a/bizmatch-server/src/drizzle/migrations/0003_tough_hobgoblin.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE "commercials" ADD COLUMN "listingsCategory" varchar(255);
\ No newline at end of file
diff --git a/bizmatch-server/src/drizzle/migrations/meta/0000_snapshot.json b/bizmatch-server/src/drizzle/migrations/meta/0000_snapshot.json
index ee3919b..140155f 100644
--- a/bizmatch-server/src/drizzle/migrations/meta/0000_snapshot.json
+++ b/bizmatch-server/src/drizzle/migrations/meta/0000_snapshot.json
@@ -1,5 +1,5 @@
{
- "id": "f6d421f9-2394-4a1c-9268-9e46285f0a41",
+ "id": "98e2be90-3301-49a8-b323-78d9d8f79cb5",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
@@ -250,6 +250,12 @@
"primaryKey": false,
"notNull": false
},
+ "listingsCategory": {
+ "name": "listingsCategory",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
"hideImage": {
"name": "hideImage",
"type": "boolean",
@@ -294,7 +300,7 @@
},
"imageOrder": {
"name": "imageOrder",
- "type": "varchar(30)[]",
+ "type": "varchar(200)[]",
"primaryKey": false,
"notNull": false
},
@@ -421,7 +427,7 @@
},
"areasServed": {
"name": "areasServed",
- "type": "varchar(100)[]",
+ "type": "jsonb",
"primaryKey": false,
"notNull": false
},
@@ -439,7 +445,13 @@
},
"licensedIn": {
"name": "licensedIn",
- "type": "varchar(50)[]",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gender": {
+ "name": "gender",
+ "type": "gender",
"primaryKey": false,
"notNull": false
}
@@ -450,7 +462,15 @@
"uniqueConstraints": {}
}
},
- "enums": {},
+ "enums": {
+ "gender": {
+ "name": "gender",
+ "values": {
+ "male": "male",
+ "female": "female"
+ }
+ }
+ },
"schemas": {},
"_meta": {
"columns": {},
diff --git a/bizmatch-server/src/drizzle/migrations/meta/0001_snapshot.json b/bizmatch-server/src/drizzle/migrations/meta/0001_snapshot.json
index 61a17bb..49144b2 100644
--- a/bizmatch-server/src/drizzle/migrations/meta/0001_snapshot.json
+++ b/bizmatch-server/src/drizzle/migrations/meta/0001_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "3e4b8c5f-4474-4877-abec-38283408ee34",
- "prevId": "f6d421f9-2394-4a1c-9268-9e46285f0a41",
+ "id": "41802273-1335-433f-97cb-77774ddb3362",
+ "prevId": "98e2be90-3301-49a8-b323-78d9d8f79cb5",
"version": "5",
"dialect": "pg",
"tables": {
@@ -250,6 +250,12 @@
"primaryKey": false,
"notNull": false
},
+ "listingsCategory": {
+ "name": "listingsCategory",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
"hideImage": {
"name": "hideImage",
"type": "boolean",
@@ -421,7 +427,7 @@
},
"areasServed": {
"name": "areasServed",
- "type": "varchar(100)[]",
+ "type": "jsonb",
"primaryKey": false,
"notNull": false
},
@@ -439,7 +445,25 @@
},
"licensedIn": {
"name": "licensedIn",
- "type": "varchar(50)[]",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gender": {
+ "name": "gender",
+ "type": "gender",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created": {
+ "name": "created",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated": {
+ "name": "updated",
+ "type": "timestamp",
"primaryKey": false,
"notNull": false
}
@@ -450,7 +474,15 @@
"uniqueConstraints": {}
}
},
- "enums": {},
+ "enums": {
+ "gender": {
+ "name": "gender",
+ "values": {
+ "male": "male",
+ "female": "female"
+ }
+ }
+ },
"schemas": {},
"_meta": {
"columns": {},
diff --git a/bizmatch-server/src/drizzle/migrations/meta/0002_snapshot.json b/bizmatch-server/src/drizzle/migrations/meta/0002_snapshot.json
deleted file mode 100644
index 8f4dff0..0000000
--- a/bizmatch-server/src/drizzle/migrations/meta/0002_snapshot.json
+++ /dev/null
@@ -1,474 +0,0 @@
-{
- "id": "ad48c6eb-2d04-442f-9242-b6765553c7c4",
- "prevId": "3e4b8c5f-4474-4877-abec-38283408ee34",
- "version": "5",
- "dialect": "pg",
- "tables": {
- "businesses": {
- "name": "businesses",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "userId": {
- "name": "userId",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "type": {
- "name": "type",
- "type": "integer",
- "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
- },
- "draft": {
- "name": "draft",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false
- },
- "listingsCategory": {
- "name": "listingsCategory",
- "type": "varchar(255)",
- "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
- },
- "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
- }
- },
- "indexes": {},
- "foreignKeys": {
- "businesses_userId_users_id_fk": {
- "name": "businesses_userId_users_id_fk",
- "tableFrom": "businesses",
- "tableTo": "users",
- "columnsFrom": [
- "userId"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {}
- },
- "commercials": {
- "name": "commercials",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "userId": {
- "name": "userId",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "type": {
- "name": "type",
- "type": "integer",
- "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
- },
- "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
- },
- "email": {
- "name": "email",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "website": {
- "name": "website",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "phoneNumber": {
- "name": "phoneNumber",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "imageOrder": {
- "name": "imageOrder",
- "type": "varchar(200)[]",
- "primaryKey": false,
- "notNull": false
- },
- "imagePath": {
- "name": "imagePath",
- "type": "varchar(50)",
- "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
- }
- },
- "indexes": {},
- "foreignKeys": {
- "commercials_userId_users_id_fk": {
- "name": "commercials_userId_users_id_fk",
- "tableFrom": "commercials",
- "tableTo": "users",
- "columnsFrom": [
- "userId"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {}
- },
- "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": "varchar(100)[]",
- "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": "varchar(50)[]",
- "primaryKey": false,
- "notNull": false
- },
- "gender": {
- "name": "gender",
- "type": "gender",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {}
- }
- },
- "enums": {
- "gender": {
- "name": "gender",
- "values": {
- "male": "male",
- "female": "female"
- }
- }
- },
- "schemas": {},
- "_meta": {
- "columns": {},
- "schemas": {},
- "tables": {}
- }
-}
\ No newline at end of file
diff --git a/bizmatch-server/src/drizzle/migrations/meta/0003_snapshot.json b/bizmatch-server/src/drizzle/migrations/meta/0003_snapshot.json
deleted file mode 100644
index 939c657..0000000
--- a/bizmatch-server/src/drizzle/migrations/meta/0003_snapshot.json
+++ /dev/null
@@ -1,480 +0,0 @@
-{
- "id": "da786c6a-fd5f-4629-bd5e-3ecd42ab1f2c",
- "prevId": "ad48c6eb-2d04-442f-9242-b6765553c7c4",
- "version": "5",
- "dialect": "pg",
- "tables": {
- "businesses": {
- "name": "businesses",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "userId": {
- "name": "userId",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "type": {
- "name": "type",
- "type": "integer",
- "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
- },
- "draft": {
- "name": "draft",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false
- },
- "listingsCategory": {
- "name": "listingsCategory",
- "type": "varchar(255)",
- "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
- },
- "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
- }
- },
- "indexes": {},
- "foreignKeys": {
- "businesses_userId_users_id_fk": {
- "name": "businesses_userId_users_id_fk",
- "tableFrom": "businesses",
- "tableTo": "users",
- "columnsFrom": [
- "userId"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {}
- },
- "commercials": {
- "name": "commercials",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "userId": {
- "name": "userId",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "type": {
- "name": "type",
- "type": "integer",
- "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": "varchar(255)",
- "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
- },
- "email": {
- "name": "email",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "website": {
- "name": "website",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "phoneNumber": {
- "name": "phoneNumber",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "imageOrder": {
- "name": "imageOrder",
- "type": "varchar(200)[]",
- "primaryKey": false,
- "notNull": false
- },
- "imagePath": {
- "name": "imagePath",
- "type": "varchar(50)",
- "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
- }
- },
- "indexes": {},
- "foreignKeys": {
- "commercials_userId_users_id_fk": {
- "name": "commercials_userId_users_id_fk",
- "tableFrom": "commercials",
- "tableTo": "users",
- "columnsFrom": [
- "userId"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {}
- },
- "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": "varchar(100)[]",
- "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": "varchar(50)[]",
- "primaryKey": false,
- "notNull": false
- },
- "gender": {
- "name": "gender",
- "type": "gender",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {}
- }
- },
- "enums": {
- "gender": {
- "name": "gender",
- "values": {
- "male": "male",
- "female": "female"
- }
- }
- },
- "schemas": {},
- "_meta": {
- "columns": {},
- "schemas": {},
- "tables": {}
- }
-}
\ No newline at end of file
diff --git a/bizmatch-server/src/drizzle/migrations/meta/_journal.json b/bizmatch-server/src/drizzle/migrations/meta/_journal.json
index 9153cf7..318a7de 100644
--- a/bizmatch-server/src/drizzle/migrations/meta/_journal.json
+++ b/bizmatch-server/src/drizzle/migrations/meta/_journal.json
@@ -5,29 +5,15 @@
{
"idx": 0,
"version": "5",
- "when": 1714913766996,
- "tag": "0000_third_spacker_dave",
+ "when": 1715627517508,
+ "tag": "0000_open_hannibal_king",
"breakpoints": true
},
{
"idx": 1,
"version": "5",
- "when": 1714981666488,
- "tag": "0001_rapid_daimon_hellstrom",
- "breakpoints": true
- },
- {
- "idx": 2,
- "version": "5",
- "when": 1714982539265,
- "tag": "0002_black_zaladane",
- "breakpoints": true
- },
- {
- "idx": 3,
- "version": "5",
- "when": 1715254754561,
- "tag": "0003_tough_hobgoblin",
+ "when": 1715631674334,
+ "tag": "0001_charming_thundra",
"breakpoints": true
}
]
diff --git a/bizmatch-server/src/drizzle/schema.ts b/bizmatch-server/src/drizzle/schema.ts
index 560453e..ad22ce1 100644
--- a/bizmatch-server/src/drizzle/schema.ts
+++ b/bizmatch-server/src/drizzle/schema.ts
@@ -1,4 +1,5 @@
-import { boolean, char, doublePrecision, integer, pgEnum, pgTable, text, timestamp, uuid, varchar } from 'drizzle-orm/pg-core';
+import { boolean, char, doublePrecision, integer, jsonb, pgEnum, pgTable, text, timestamp, uuid, varchar } from 'drizzle-orm/pg-core';
+import { AreasServed, LicensedIn } from 'src/models/db.model';
export const PG_CONNECTION = 'PG_CONNECTION';
export const genderEnum = pgEnum('gender', ['male', 'female']);
@@ -14,11 +15,13 @@ export const users = pgTable('users', {
companyWebsite: varchar('companyWebsite', { length: 255 }),
companyLocation: varchar('companyLocation', { length: 255 }),
offeredServices: text('offeredServices'),
- areasServed: varchar('areasServed', { length: 100 }).array(),
+ areasServed: jsonb('areasServed').$type(),
hasProfile: boolean('hasProfile'),
hasCompanyLogo: boolean('hasCompanyLogo'),
- licensedIn: varchar('licensedIn', { length: 50 }).array(),
+ licensedIn: jsonb('licensedIn').$type(),
gender: genderEnum('gender'),
+ created: timestamp('created'),
+ updated: timestamp('updated'),
});
export const businesses = pgTable('businesses', {
diff --git a/bizmatch-server/src/image/image.controller.ts b/bizmatch-server/src/image/image.controller.ts
index b31c547..049e90f 100644
--- a/bizmatch-server/src/image/image.controller.ts
+++ b/bizmatch-server/src/image/image.controller.ts
@@ -6,8 +6,8 @@ import { FileService } from '../file/file.service.js';
import { ListingsService } from '../listings/listings.service.js';
import { SelectOptionsService } from '../select-options/select-options.service.js';
-import { commercials } from 'src/drizzle/schema.js';
-import { CommercialPropertyListing } from 'src/models/db.model.js';
+import { commercials } from '../drizzle/schema.js';
+import { CommercialPropertyListing } from '../models/db.model.js';
@Controller('image')
export class ImageController {
diff --git a/bizmatch-server/src/listings/unknown-listings.controller.ts b/bizmatch-server/src/listings/unknown-listings.controller.ts
index d5601e9..9bd7d77 100644
--- a/bizmatch-server/src/listings/unknown-listings.controller.ts
+++ b/bizmatch-server/src/listings/unknown-listings.controller.ts
@@ -1,27 +1,23 @@
-import { Body, Controller, Delete, Get, Inject, Param, Post, Put } from '@nestjs/common';
-import { FileService } from '../file/file.service.js';
-import { convertStringToNullUndefined } from '../utils.js';
-import { ListingsService } from './listings.service.js';
+import { Controller, Get, Inject, Param } from '@nestjs/common';
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { Logger } from 'winston';
-import { businesses, commercials } from 'src/drizzle/schema.js';
-
+import { businesses, commercials } from '../drizzle/schema.js';
+import { ListingsService } from './listings.service.js';
@Controller('listings/undefined')
export class UnknownListingsController {
-
- constructor(private readonly listingsService:ListingsService,@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {
- }
+ constructor(
+ private readonly listingsService: ListingsService,
+ @Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
+ ) {}
@Get(':id')
- async findById(@Param('id') id:string): Promise {
- const result = await this.listingsService.findById(id,businesses);
- if (result){
- return result
+ async findById(@Param('id') id: string): Promise {
+ const result = await this.listingsService.findById(id, businesses);
+ if (result) {
+ return result;
} else {
- return await this.listingsService.findById(id,commercials);
+ return await this.listingsService.findById(id, commercials);
}
}
-
}
-
diff --git a/bizmatch-server/src/mail/templates/inquiry.hbs b/bizmatch-server/src/mail/templates/inquiry.hbs
index 1fd5d37..a09bde3 100644
--- a/bizmatch-server/src/mail/templates/inquiry.hbs
+++ b/bizmatch-server/src/mail/templates/inquiry.hbs
@@ -1,5 +1,12 @@
-Hey {{ name }},
-You got an inquiry a
+Dear {{ name }},
+You got an inquiry regarding your '{{title}}'' listing
- {{inquiry}}
-
\ No newline at end of file
+ Buyers Information
+
+ Contact Name: {{iname}}
+ Contact Phone: {{phone}}
+ Contact Mail: {{email}}
+ Contact Name: {{iname}}
+ Comments: {{inquiry}}
+
+Internal Listing Number: {{internalListingNumber}}
\ No newline at end of file
diff --git a/bizmatch-server/src/models/db.model.ts b/bizmatch-server/src/models/db.model.ts
index 84e1e37..71c9daf 100644
--- a/bizmatch-server/src/models/db.model.ts
+++ b/bizmatch-server/src/models/db.model.ts
@@ -1,4 +1,24 @@
export interface User {
+ id?: string;
+ firstname: string;
+ lastname: string;
+ email: string;
+ phoneNumber?: string;
+ description?: string;
+ companyName?: string;
+ companyOverview?: string;
+ companyWebsite?: string;
+ companyLocation?: string;
+ offeredServices?: string;
+ areasServed?: AreasServed[];
+ hasProfile?: boolean;
+ hasCompanyLogo?: boolean;
+ licensedIn?: LicensedIn[];
+ gender?: 'male' | 'female';
+ created?: Date;
+ updated?: Date;
+}
+export interface UserData {
id?: string;
firstname: string;
lastname: string;
@@ -14,8 +34,10 @@ export interface User {
hasProfile?: boolean;
hasCompanyLogo?: boolean;
licensedIn?: string[];
+ gender?: 'male' | 'female';
+ created?: Date;
+ updated?: Date;
}
-
export interface BusinessListing {
id: string;
userId?: string;
@@ -71,3 +93,11 @@ export interface CommercialPropertyListing {
lastVisit?: Date;
listingsCategory?: string;
}
+export interface AreasServed {
+ county: string;
+ state: string;
+}
+export interface LicensedIn {
+ registerNo: string;
+ state: string;
+}
diff --git a/bizmatch-server/src/user/user.service.ts b/bizmatch-server/src/user/user.service.ts
index 4142932..c52779e 100644
--- a/bizmatch-server/src/user/user.service.ts
+++ b/bizmatch-server/src/user/user.service.ts
@@ -2,11 +2,11 @@ import { Inject, Injectable } from '@nestjs/common';
import { and, eq, ilike, or, sql } from 'drizzle-orm';
import { NodePgDatabase } from 'drizzle-orm/node-postgres/driver.js';
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
-import { PG_CONNECTION } from 'src/drizzle/schema.js';
-import { User } from 'src/models/db.model.js';
import { Logger } from 'winston';
import * as schema from '../drizzle/schema.js';
+import { PG_CONNECTION } from '../drizzle/schema.js';
import { FileService } from '../file/file.service.js';
+import { User } from '../models/db.model.js';
import { ListingCriteria } from '../models/main.model.js';
@Injectable()
@@ -48,9 +48,13 @@ export class UserService {
}
async saveUser(user: any): Promise {
if (user.id) {
+ user.created = new Date(user.created);
+ user.updated = new Date();
const [updateUser] = await this.conn.update(schema.users).set(user).where(eq(schema.users.id, user.id)).returning();
return updateUser as User;
} else {
+ user.created = new Date();
+ user.updated = new Date();
const [newUser] = await this.conn.insert(schema.users).values(user).returning();
return newUser as User;
}
diff --git a/bizmatch/package.json b/bizmatch/package.json
index 3805cb1..c6673b9 100644
--- a/bizmatch/package.json
+++ b/bizmatch/package.json
@@ -40,7 +40,7 @@
"on-change": "^5.0.1",
"primeflex": "^3.3.1",
"primeicons": "^6.0.1",
- "primeng": "^17.10.0",
+ "primeng": "^17.16.1",
"quill": "^1.3.7",
"rxjs": "~7.8.1",
"tslib": "^2.3.0",
diff --git a/bizmatch/src/app/app.routes.ts b/bizmatch/src/app/app.routes.ts
index 068ac27..3e069b0 100644
--- a/bizmatch/src/app/app.routes.ts
+++ b/bizmatch/src/app/app.routes.ts
@@ -59,6 +59,11 @@ export const routes: Routes = [
component: AccountComponent,
canActivate: [authGuard],
},
+ {
+ path: 'account/:id',
+ component: AccountComponent,
+ canActivate: [authGuard],
+ },
// #########
// Create, Update Listings
{
diff --git a/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html b/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html
index edf2ea9..cddc4f8 100644
--- a/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html
+++ b/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html
@@ -1,7 +1,7 @@
-
+
{{ listing?.title }}
@@ -40,17 +40,19 @@
{{ listing.price | currency }}
+
+ @if(listing && user && (user.id===listing?.userId || isAdmin())){
+
+ }
+
+
+
- @if(listing && user && (user.id===listing?.userId || isAdmin())){
-
- }
-
- @if (mailinfo){
-
+ @if (mailinfo){
Contact The Author of This Listing
Please Include your contact info below:
@@ -80,8 +82,8 @@
+ }
- }
}
diff --git a/bizmatch/src/app/pages/details/details-user/details-user.component.html b/bizmatch/src/app/pages/details/details-user/details-user.component.html
index 9edf3ca..5756878 100644
--- a/bizmatch/src/app/pages/details/details-user/details-user.component.html
+++ b/bizmatch/src/app/pages/details/details-user/details-user.component.html
@@ -10,7 +10,7 @@
@if(user.hasProfile){
-

+

} @else {

}
@@ -34,7 +34,7 @@
@if(user.hasCompanyLogo){
-

+

}
@@ -74,10 +74,10 @@
- Areas we serve
+ Areas (Counties) we serve
@for (area of user.areasServed; track area) {
-
+
}
Total number of Listings: {{ totalRecords }}
diff --git a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.scss b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.scss
index 57253e1..dfe54a9 100644
--- a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.scss
+++ b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.scss
@@ -1,23 +1,23 @@
#sky-line {
- background-image: url(../../../../assets/images/bw-sky.jpg);
- height: 204px;
- background-position: bottom;
- background-size: cover;
- margin-bottom: -1px;
+ background-image: url(../../../../assets/images/bw-sky.jpg);
+ height: 204px;
+ background-position: bottom;
+ background-size: cover;
+ margin-bottom: -1px;
}
-.search{
- background-color: #343F69;
+.search {
+ background-color: #343f69;
}
::ng-deep p-paginator div {
- background-color: var(--surface-200) !important;
- // background-color: var(--surface-400) !important;
+ background-color: var(--surface-200) !important;
+ // background-color: var(--surface-400) !important;
}
.rounded-image {
- border-radius: 6px;
- // width: 100px;
- max-width: 100px;
- height: 45px;
- border: 1px solid rgba(0,0,0,0.2);
- padding: 1px 1px;
- object-fit: contain;
-}
\ No newline at end of file
+ border-radius: 6px;
+ // width: 100px;
+ max-width: 100px;
+ height: 45px;
+ border: 1px solid rgba(0, 0, 0, 0.2);
+ padding: 1px 1px;
+ object-fit: contain;
+}
diff --git a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts
index a854f4b..80d3ae4 100644
--- a/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts
+++ b/bizmatch/src/app/pages/listings/commercial-property-listings/commercial-property-listings.component.ts
@@ -24,7 +24,7 @@ import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from
standalone: true,
imports: [CommonModule, StyleClassModule, ButtonModule, CheckboxModule, InputTextModule, DropdownModule, FormsModule, StyleClassModule, ToggleButtonModule, RouterModule, PaginatorModule, InputGroupModule],
templateUrl: './commercial-property-listings.component.html',
- styleUrl: './commercial-property-listings.component.scss',
+ styleUrls: ['./commercial-property-listings.component.scss', '../../pages.scss'],
})
export class CommercialPropertyListingsComponent {
environment = environment;
@@ -41,7 +41,6 @@ export class CommercialPropertyListingsComponent {
statesSet = new Set();
state: string;
totalRecords: number = 0;
- ts = new Date().getTime();
constructor(
public selectOptions: SelectOptionsService,
@@ -53,10 +52,11 @@ export class CommercialPropertyListingsComponent {
private route: ActivatedRoute,
) {
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
- this.criteria.type = undefined;
this.route.data.subscribe(async () => {
if (this.router.getCurrentNavigation().extras.state) {
resetCriteria(this.criteria);
+ } else {
+ this.first = this.criteria.page * this.criteria.length;
}
this.init();
});
diff --git a/bizmatch/src/app/pages/pages.scss b/bizmatch/src/app/pages/pages.scss
index f0f0bbd..e24ef63 100644
--- a/bizmatch/src/app/pages/pages.scss
+++ b/bizmatch/src/app/pages/pages.scss
@@ -1,6 +1,16 @@
.wrapper {
- width: 1491px;
- max-width: 100%;
- height: 100%;
- margin: auto;
-}
\ No newline at end of file
+ width: 1491px;
+ max-width: 100%;
+ height: 100%;
+ margin: auto;
+}
+:host ::ng-deep .paginator-bar {
+ position: sticky;
+ bottom: 0px;
+ & > button {
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Schatten-/Unschärfe-Effekt */
+ }
+ & .p-paginator {
+ padding: 0;
+ }
+}
diff --git a/bizmatch/src/app/pages/subscription/account/account.component.html b/bizmatch/src/app/pages/subscription/account/account.component.html
index 1886205..708e902 100644
--- a/bizmatch/src/app/pages/subscription/account/account.component.html
+++ b/bizmatch/src/app/pages/subscription/account/account.component.html
@@ -62,17 +62,13 @@
-
-
-
-
- @for (licensedIn of userLicensedIn; track licensedIn.value){
+ @for (areasServed of user.areasServed; track areasServed){
+ }
+
+
+
+
+
(Add more Areas or remove existing ones.)
+
+
+
+
+ @for (licensedIn of user.licensedIn; track licensedIn){
+
}
diff --git a/bizmatch/src/app/pages/subscription/account/account.component.ts b/bizmatch/src/app/pages/subscription/account/account.component.ts
index 6ffaa57..1aa52a6 100644
--- a/bizmatch/src/app/pages/subscription/account/account.component.ts
+++ b/bizmatch/src/app/pages/subscription/account/account.component.ts
@@ -10,7 +10,7 @@ import { FileUpload, FileUploadModule } from 'primeng/fileupload';
import { SelectButtonModule } from 'primeng/selectbutton';
import { lastValueFrom } from 'rxjs';
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
-import { AutoCompleteCompleteEvent, Invoice, KeyValue, Subscription } from '../../../../../../bizmatch-server/src/models/main.model';
+import { AutoCompleteCompleteEvent, Invoice, Subscription } from '../../../../../../bizmatch-server/src/models/main.model';
import { environment } from '../../../../environments/environment';
import { ImageCropperComponent, stateOptions } from '../../../components/image-cropper/image-cropper.component';
import { GeoService } from '../../../services/geo.service';
@@ -36,14 +36,13 @@ export class AccountComponent {
user: User;
subscriptions: Array
;
userSubscriptions: Array = [];
- maxFileSize = 1000000;
+ maxFileSize = 15000000;
companyLogoUrl: string;
profileUrl: string;
type: 'company' | 'profile';
dialogRef: DynamicDialogRef | undefined;
environment = environment;
editorModules = TOOLBAR_OPTIONS;
- userLicensedIn: KeyValue[];
constructor(
public userService: UserService,
private subscriptionService: SubscriptionsService,
@@ -57,30 +56,26 @@ export class AccountComponent {
public dialogService: DialogService,
) {}
async ngOnInit() {
- const keycloakUser = this.userService.getKeycloakUser();
- const email = keycloakUser.email;
- try {
- this.user = await this.userService.getByMail(email);
- } catch (e) {
- this.user = { email, firstname: keycloakUser.firstname, lastname: keycloakUser.lastname };
- this.user = await this.userService.save(this.user);
+ if (this.id) {
+ this.user = await this.userService.getById(this.id);
+ } else {
+ const keycloakUser = this.userService.getKeycloakUser();
+ const email = keycloakUser.email;
+ try {
+ this.user = await this.userService.getByMail(email);
+ } catch (e) {
+ this.user = { email, firstname: keycloakUser.firstname, lastname: keycloakUser.lastname, areasServed: [], licensedIn: [] };
+ this.user = await this.userService.save(this.user);
+ }
}
- this.userLicensedIn = this.user.licensedIn
- ? this.user.licensedIn.map(l => {
- return { name: l.split('|')[0], value: l.split('|')[1] };
- })
- : [];
+
this.userSubscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions());
- if (!this.user.licensedIn || this.user.licensedIn?.length === 0) {
- this.user.licensedIn = [''];
- }
- this.profileUrl = this.user.hasProfile ? `pictures/profile/${this.user.id}.avif` : `/assets/images/placeholder.png`;
- this.companyLogoUrl = this.user.hasCompanyLogo ? `pictures/logo/${this.user.id}.avif` : `/assets/images/placeholder.png`;
+ this.profileUrl = this.user.hasProfile ? `/pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
+ this.companyLogoUrl = this.user.hasCompanyLogo ? `/pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
}
printInvoice(invoice: Invoice) {}
async updateProfile(user: User) {
- this.user.licensedIn = this.userLicensedIn.map(l => `${l.name}|${l.value}`);
await this.userService.save(this.user);
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Acount changes have been persisted', life: 3000 });
}
@@ -104,12 +99,17 @@ export class AccountComponent {
this.suggestions = result.map(r => `${r.city} - ${r.state_code}`).slice(0, 5);
}
addLicence() {
- this.userLicensedIn.push({ name: '', value: '' });
+ this.user.licensedIn.push({ registerNo: '', state: '' });
}
removeLicence() {
- this.userLicensedIn.splice(this.user.licensedIn.length - 2, 1);
+ this.user.licensedIn.splice(this.user.licensedIn.length - 1, 1);
+ }
+ addArea() {
+ this.user.areasServed.push({ county: '', state: '' });
+ }
+ removeArea() {
+ this.user.areasServed.splice(this.user.areasServed.length - 1, 1);
}
-
select(event: any, type: 'company' | 'profile') {
const imageUrl = URL.createObjectURL(event.files[0]);
this.type = type;
@@ -142,11 +142,12 @@ export class AccountComponent {
this.loadingService.stopLoading('uploadImage');
if (this.type === 'company') {
this.user.hasCompanyLogo = true; //
- this.companyLogoUrl = `${environment.apiBaseUrl}/logo/${this.user.id}.avif?_ts=${new Date().getTime()}`;
+ this.companyLogoUrl = `pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}`;
} else {
this.user.hasProfile = true;
- this.profileUrl = `${environment.apiBaseUrl}/profile/${this.user.id}.avif?_ts=${new Date().getTime()}`;
+ this.profileUrl = `pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}`;
}
+ await this.userService.save(this.user);
}
},
error => console.error('Fehler beim Upload:', error),
diff --git a/bizmatch/src/app/pages/subscription/edit-business-listing/edit-business-listing.component.html b/bizmatch/src/app/pages/subscription/edit-business-listing/edit-business-listing.component.html
index 8e86c8f..31dd5c0 100644
--- a/bizmatch/src/app/pages/subscription/edit-business-listing/edit-business-listing.component.html
+++ b/bizmatch/src/app/pages/subscription/edit-business-listing/edit-business-listing.component.html
@@ -66,27 +66,27 @@
-
-
+
+
@@ -119,7 +119,7 @@
-
+