Umbau zu tailwind + mobile friendly: LandingPage & Footer

This commit is contained in:
2024-07-02 19:17:14 +02:00
parent 3d5b7e3f39
commit 958f0afd9b
32 changed files with 1464 additions and 699 deletions

View File

@@ -0,0 +1,385 @@
[
{
"state": "AL",
"counties": [
"Autauga",
"Baldwin",
"Barbour",
"Bibb",
"Blount",
"Bullock",
"Butler",
"Calhoun",
"Chambers",
"Cherokee",
"Chilton",
"Choctaw",
"Clarke",
"Clay",
"Cleburne",
"Coffee",
"Colbert",
"Conecuh",
"Coosa",
"Covington",
"Crenshaw",
"Cullman",
"Dale",
"Dallas",
"DeKalb",
"Elmore",
"Escambia",
"Etowah",
"Fayette",
"Franklin",
"Geneva",
"Greene",
"Hale",
"Henry",
"Houston",
"Jackson",
"Jefferson",
"Lamar",
"Lauderdale",
"Lawrence",
"Lee",
"Limestone",
"Lowndes",
"Macon",
"Madison",
"Marengo",
"Marion",
"Marshall",
"Mobile",
"Monroe",
"Montgomery",
"Morgan",
"Perry",
"Pickens",
"Pike",
"Randolph",
"Russell",
"St. Clair",
"Shelby",
"Sumter",
"Talladega",
"Tallapoosa",
"Tuscaloosa",
"Walker",
"Washington",
"Wilcox",
"Winston"
]
},
{
"state": "AK",
"counties": [
"Aleutians East",
"Aleutians West",
"Anchorage",
"Bethel",
"Bristol Bay",
"Denali",
"Dillingham",
"Fairbanks North Star",
"Haines",
"Juneau",
"Kenai Peninsula",
"Ketchikan Gateway",
"Kodiak Island",
"Lake and Peninsula",
"Matanuska-Susitna",
"Nome",
"North Slope",
"Northwest Arctic",
"Petersburg",
"Prince of Wales-Hyder",
"Sitka",
"Skagway",
"Southeast Fairbanks",
"Valdez-Cordova",
"Wrangell",
"Yakutat",
"Yukon-Koyukuk"
]
},
{
"state": "AZ",
"counties": [
"Apache",
"Cochise",
"Coconino",
"Gila",
"Graham",
"Greenlee",
"La Paz",
"Maricopa",
"Mohave",
"Navajo",
"Pima",
"Pinal",
"Santa Cruz",
"Yavapai",
"Yuma"
]
},
{
"state": "TX",
"counties": [
"Anderson",
"Andrews",
"Angelina",
"Aransas",
"Archer",
"Armstrong",
"Atascosa",
"Austin",
"Bailey",
"Bandera",
"Bastrop",
"Baylor",
"Bee",
"Bell",
"Bexar",
"Blanco",
"Borden",
"Bosque",
"Bowie",
"Brazoria",
"Brazos",
"Brewster",
"Briscoe",
"Brooks",
"Brown",
"Burleson",
"Burnet",
"Caldwell",
"Calhoun",
"Callahan",
"Cameron",
"Camp",
"Carson",
"Cass",
"Castro",
"Chambers",
"Cherokee",
"Childress",
"Clay",
"Cochran",
"Coke",
"Coleman",
"Collin",
"Collingsworth",
"Colorado",
"Comal",
"Comanche",
"Concho",
"Cooke",
"Coryell",
"Cottle",
"Crane",
"Crockett",
"Crosby",
"Culberson",
"Dallam",
"Dallas",
"Dawson",
"Deaf Smith",
"Delta",
"Denton",
"DeWitt",
"Dickens",
"Dimmit",
"Donley",
"Duval",
"Eastland",
"Ector",
"Edwards",
"Ellis",
"El Paso",
"Erath",
"Falls",
"Fannin",
"Fayette",
"Fisher",
"Floyd",
"Foard",
"Fort Bend",
"Franklin",
"Freestone",
"Frio",
"Gaines",
"Galveston",
"Garza",
"Gillespie",
"Glasscock",
"Goliad",
"Gonzales",
"Gray",
"Grayson",
"Gregg",
"Grimes",
"Guadalupe",
"Hale",
"Hall",
"Hamilton",
"Hansford",
"Hardeman",
"Hardin",
"Harris",
"Harrison",
"Hartley",
"Haskell",
"Hays",
"Hemphill",
"Henderson",
"Hidalgo",
"Hill",
"Hockley",
"Hood",
"Hopkins",
"Houston",
"Howard",
"Hudspeth",
"Hunt",
"Hutchinson",
"Irion",
"Jack",
"Jackson",
"Jasper",
"Jeff Davis",
"Jefferson",
"Jim Hogg",
"Jim Wells",
"Johnson",
"Jones",
"Karnes",
"Kaufman",
"Kendall",
"Kenedy",
"Kent",
"Kerr",
"Kimble",
"King",
"Kinney",
"Kleberg",
"Knox",
"Lamar",
"Lamb",
"Lampasas",
"La Salle",
"Lavaca",
"Lee",
"Leon",
"Liberty",
"Limestone",
"Lipscomb",
"Live Oak",
"Llano",
"Loving",
"Lubbock",
"Lynn",
"McCulloch",
"McLennan",
"McMullen",
"Madison",
"Marion",
"Martin",
"Mason",
"Matagorda",
"Maverick",
"Medina",
"Menard",
"Midland",
"Milam",
"Mills",
"Mitchell",
"Montague",
"Montgomery",
"Moore",
"Morris",
"Motley",
"Nacogdoches",
"Navarro",
"Newton",
"Nolan",
"Nueces",
"Ochiltree",
"Oldham",
"Orange",
"Palo Pinto",
"Panola",
"Parker",
"Parmer",
"Pecos",
"Polk",
"Potter",
"Presidio",
"Rains",
"Randall",
"Reagan",
"Real",
"Red River",
"Reeves",
"Refugio",
"Roberts",
"Robertson",
"Rockwall",
"Runnels",
"Rusk",
"Sabine",
"San Augustine",
"San Jacinto",
"San Patricio",
"San Saba",
"Schleicher",
"Scurry",
"Shackelford",
"Shelby",
"Sherman",
"Smith",
"Somervell",
"Starr",
"Stephens",
"Sterling",
"Stonewall",
"Sutton",
"Swisher",
"Tarrant",
"Taylor",
"Terrell",
"Terry",
"Throckmorton",
"Titus",
"Tom Green",
"Travis",
"Trinity",
"Tyler",
"Upshur",
"Upton",
"Uvalde",
"Val Verde",
"Van Zandt",
"Victoria",
"Walker",
"Waller",
"Ward",
"Washington",
"Webb",
"Wharton",
"Wheeler",
"Wichita",
"Wilbarger",
"Willacy",
"Williamson",
"Wilson",
"Winkler",
"Wise",
"Wood",
"Yoakum",
"Young",
"Zapata",
"Zavala"
]
}
]

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("dotenv/config");
var node_postgres_1 = require("drizzle-orm/node-postgres");
var pg_1 = require("pg");
var Client = pg_1.default.Client;
var schema = require("./schema.js");
var fs_1 = require("fs");
var connectionString = process.env.DATABASE_URL;
// const pool = new Pool({connectionString})
var client = new Client({ connectionString: connectionString });
var db = (0, node_postgres_1.drizzle)(client, { schema: schema, logger: true });
//Broker
var filePath = "./data/broker.json";
var data = (0, fs_1.readFileSync)(filePath, 'utf8');
var jsonData = JSON.parse(data); // Erwartet ein Array von Objekten
await db.delete(schema.users);
console.log(jsonData.length);
for (var _i = 0, jsonData_1 = jsonData; _i < jsonData_1.length; _i++) {
var user = jsonData_1[_i];
delete user.id;
await db.insert(schema.users).values(user);
}
//Business Listings
// filePath = `./data/businesses.json`
// data = readFileSync(filePath, 'utf8');
// jsonData = JSON.parse(data); // Erwartet ein Array von Objekten
// db.delete(schema.businesses);
// for (const business of jsonData) {
// delete business.id
// await db.insert(schema.businesses).values(business);
// }
//End
//await client.end()

View File

@@ -63,6 +63,8 @@ for (const userData of usersData) {
user.companyLocation = userData.companyLocation;
user.offeredServices = userData.offeredServices;
user.gender = userData.gender;
user.customerType = 'professional';
user.customerSubType = 'broker';
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, email: schema.users.email });

View File

@@ -1,3 +1,15 @@
DO $$ BEGIN
CREATE TYPE "customerSubType" AS ENUM('broker', 'cpa', 'attorney', 'titleCompany', 'surveyor', 'appraiser');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
CREATE TYPE "customerType" AS ENUM('buyer', 'professional');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
CREATE TYPE "gender" AS ENUM('male', 'female');
EXCEPTION
@@ -79,6 +91,8 @@ CREATE TABLE IF NOT EXISTS "users" (
"hasCompanyLogo" boolean,
"licensedIn" jsonb,
"gender" "gender",
"customerType" "customerType",
"customerSubType" "customerSubType",
"created" timestamp,
"updated" timestamp
);

View File

@@ -1,7 +0,0 @@
DO $$ BEGIN
CREATE TYPE "customerType" AS ENUM('buyer', 'broker', 'professional');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "customerType" "customerType";

View File

@@ -1,5 +1,5 @@
{
"id": "fc58c59b-ac5c-406e-8fdb-b05de40aed17",
"id": "f8241dfe-8f15-4656-aeb5-c9ef0ad65f28",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
@@ -467,6 +467,18 @@
"primaryKey": false,
"notNull": false
},
"customerType": {
"name": "customerType",
"type": "customerType",
"primaryKey": false,
"notNull": false
},
"customerSubType": {
"name": "customerSubType",
"type": "customerSubType",
"primaryKey": false,
"notNull": false
},
"created": {
"name": "created",
"type": "timestamp",
@@ -487,6 +499,24 @@
}
},
"enums": {
"customerSubType": {
"name": "customerSubType",
"values": {
"broker": "broker",
"cpa": "cpa",
"attorney": "attorney",
"titleCompany": "titleCompany",
"surveyor": "surveyor",
"appraiser": "appraiser"
}
},
"customerType": {
"name": "customerType",
"values": {
"buyer": "buyer",
"professional": "professional"
}
},
"gender": {
"name": "gender",
"values": {

View File

@@ -1,518 +0,0 @@
{
"id": "0bc02618-4414-4e90-8c44-808737611da7",
"prevId": "fc58c59b-ac5c-406e-8fdb-b05de40aed17",
"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
},
"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
}
},
"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()"
},
"serial_id": {
"name": "serial_id",
"type": "serial",
"primaryKey": false,
"notNull": true
},
"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(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
}
},
"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": "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",
"primaryKey": false,
"notNull": false
},
"customerType": {
"name": "customerType",
"type": "customerType",
"primaryKey": false,
"notNull": false
},
"created": {
"name": "created",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"updated": {
"name": "updated",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {
"customerType": {
"name": "customerType",
"values": {
"buyer": "buyer",
"broker": "broker",
"professional": "professional"
}
},
"gender": {
"name": "gender",
"values": {
"male": "male",
"female": "female"
}
}
},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View File

@@ -5,15 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1716495198537,
"tag": "0000_burly_bruce_banner",
"breakpoints": true
},
{
"idx": 1,
"version": "5",
"when": 1717085220861,
"tag": "0001_wet_mephistopheles",
"when": 1717933164279,
"tag": "0000_known_havok",
"breakpoints": true
}
]

View File

@@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.commercials = exports.businesses = exports.users = exports.PG_CONNECTION = void 0;
var pg_core_1 = require("drizzle-orm/pg-core");
exports.PG_CONNECTION = 'PG_CONNECTION';
exports.users = (0, pg_core_1.pgTable)('users', {
id: (0, pg_core_1.uuid)('id').primaryKey().defaultRandom(),
firstname: (0, pg_core_1.varchar)('firstname', { length: 255 }).notNull(),
lastname: (0, pg_core_1.varchar)('lastname', { length: 255 }).notNull(),
email: (0, pg_core_1.varchar)('email', { length: 255 }).notNull(),
phoneNumber: (0, pg_core_1.varchar)('phoneNumber', { length: 255 }),
description: (0, pg_core_1.text)('description'),
companyName: (0, pg_core_1.varchar)('companyName', { length: 255 }),
companyOverview: (0, pg_core_1.text)('companyOverview'),
companyWebsite: (0, pg_core_1.varchar)('companyWebsite', { length: 255 }),
companyLocation: (0, pg_core_1.varchar)('companyLocation', { length: 255 }),
offeredServices: (0, pg_core_1.text)('offeredServices'),
areasServed: (0, pg_core_1.varchar)('areasServed', { length: 100 }).array(),
hasProfile: (0, pg_core_1.boolean)('hasProfile'),
hasCompanyLogo: (0, pg_core_1.boolean)('hasCompanyLogo'),
licensedIn: (0, pg_core_1.varchar)('licensedIn', { length: 50 }).array(),
});
exports.businesses = (0, pg_core_1.pgTable)('businesses', {
id: (0, pg_core_1.uuid)('id').primaryKey().defaultRandom(),
userId: (0, pg_core_1.uuid)('userId').references(function () { return exports.users.id; }),
type: (0, pg_core_1.varchar)('type', { length: 255 }),
title: (0, pg_core_1.varchar)('title', { length: 255 }),
description: (0, pg_core_1.text)('description'),
city: (0, pg_core_1.varchar)('city', { length: 255 }),
state: (0, pg_core_1.char)('state', { length: 2 }),
price: (0, pg_core_1.numeric)('price', { precision: 10, scale: 2 }),
favoritesForUser: (0, pg_core_1.varchar)('favoritesForUser', { length: 30 }).array(),
draft: (0, pg_core_1.boolean)('draft'),
listingsCategory: (0, pg_core_1.varchar)('listingsCategory', { length: 255 }),
realEstateIncluded: (0, pg_core_1.boolean)('realEstateIncluded'),
leasedLocation: (0, pg_core_1.boolean)('leasedLocation'),
franchiseResale: (0, pg_core_1.boolean)('franchiseResale'),
salesRevenue: (0, pg_core_1.numeric)('salesRevenue', { precision: 10, scale: 2 }),
cashFlow: (0, pg_core_1.numeric)('cashFlow', { precision: 10, scale: 2 }),
supportAndTraining: (0, pg_core_1.text)('supportAndTraining'),
employees: (0, pg_core_1.integer)('employees'),
established: (0, pg_core_1.integer)('established'),
internalListingNumber: (0, pg_core_1.integer)('internalListingNumber'),
reasonForSale: (0, pg_core_1.varchar)('reasonForSale', { length: 255 }),
brokerLicencing: (0, pg_core_1.varchar)('brokerLicencing', { length: 255 }),
internals: (0, pg_core_1.text)('internals'),
created: (0, pg_core_1.timestamp)('created'),
updated: (0, pg_core_1.timestamp)('updated'),
visits: (0, pg_core_1.integer)('visits'),
lastVisit: (0, pg_core_1.timestamp)('lastVisit'),
});
exports.commercials = (0, pg_core_1.pgTable)('commercials', {
id: (0, pg_core_1.uuid)('id').primaryKey().defaultRandom(),
userId: (0, pg_core_1.uuid)('userId').references(function () { return exports.users.id; }),
type: (0, pg_core_1.varchar)('type', { length: 255 }),
title: (0, pg_core_1.varchar)('title', { length: 255 }),
description: (0, pg_core_1.text)('description'),
city: (0, pg_core_1.varchar)('city', { length: 255 }),
state: (0, pg_core_1.char)('state', { length: 2 }),
price: (0, pg_core_1.numeric)('price', { precision: 10, scale: 2 }),
favoritesForUser: (0, pg_core_1.varchar)('favoritesForUser', { length: 30 }).array(),
hideImage: (0, pg_core_1.boolean)('hideImage'),
draft: (0, pg_core_1.boolean)('draft'),
zipCode: (0, pg_core_1.integer)('zipCode'),
county: (0, pg_core_1.varchar)('county', { length: 255 }),
email: (0, pg_core_1.varchar)('email', { length: 255 }),
website: (0, pg_core_1.varchar)('website', { length: 255 }),
phoneNumber: (0, pg_core_1.varchar)('phoneNumber', { length: 255 }),
imageOrder: (0, pg_core_1.varchar)('imageOrder', { length: 30 }).array(),
imagePath: (0, pg_core_1.varchar)('imagePath', { length: 30 }).array(),
created: (0, pg_core_1.timestamp)('created'),
updated: (0, pg_core_1.timestamp)('updated'),
visits: (0, pg_core_1.integer)('visits'),
lastVisit: (0, pg_core_1.timestamp)('lastVisit'),
});

View File

@@ -3,7 +3,8 @@ import { AreasServed, LicensedIn } from 'src/models/db.model';
export const PG_CONNECTION = 'PG_CONNECTION';
export const genderEnum = pgEnum('gender', ['male', 'female']);
export const customerTypeEnum = pgEnum('customerType', ['buyer', 'broker', 'professional']);
export const customerTypeEnum = pgEnum('customerType', ['buyer', 'professional']);
export const customerSubTypeEnum = pgEnum('customerSubType', ['broker', 'cpa', 'attorney', 'titleCompany', 'surveyor', 'appraiser']);
export const users = pgTable('users', {
id: uuid('id').primaryKey().defaultRandom(),
@@ -23,6 +24,7 @@ export const users = pgTable('users', {
licensedIn: jsonb('licensedIn').$type<LicensedIn[]>(),
gender: genderEnum('gender'),
customerType: customerTypeEnum('customerType'),
customerSubType: customerSubTypeEnum('customerSubType'),
created: timestamp('created'),
updated: timestamp('updated'),
});

View File

@@ -0,0 +1,21 @@
const fs = require('fs');
const path = require('path');
// Angenommen, du hast eine Datei `databaseModels.js` mit deinen pgTable-Definitionen
const { users } = require('./schema.js');
function generateTypeScriptInterface(tableDefinition, tableName) {
let interfaceString = `export interface ${tableName} {\n`;
for (const [column, definition] of Object.entries(tableDefinition)) {
// Du musst die Definition parsen, um den korrekten Typ zu extrahieren
const tsType = definition.type === 'uuid' ? 'string' :
definition.type.startsWith('varchar') || definition.type === 'text' ? 'string' :
definition.type === 'boolean' ? 'boolean' : 'any';
interfaceString += ` ${column}${definition.optional ? '?' : ''}: ${tsType};\n`;
}
interfaceString += '}\n';
return interfaceString;
}
const userModelInterface = generateTypeScriptInterface(users.columns, 'User');
fs.writeFileSync(path.join(__dirname, 'UserInterface.ts'), userModelInterface);

View File

@@ -15,7 +15,8 @@ export interface User {
hasCompanyLogo?: boolean;
licensedIn?: LicensedIn[];
gender?: 'male' | 'female';
customerType?: 'buyer' | 'broker' | 'professional';
customerType?: 'buyer' | 'professional';
customerSubType?: 'broker' | 'cpa' | 'attorney' | 'titleCompany' | 'surveyor' | 'appraiser';
created?: Date;
updated?: Date;
}
@@ -37,6 +38,7 @@ export interface UserData {
licensedIn?: string[];
gender?: 'male' | 'female';
customerType?: 'buyer' | 'broker' | 'professional';
customerSubType?: 'broker' | 'cpa' | 'attorney' | 'titleCompany' | 'surveyor' | 'appraiser';
created?: Date;
updated?: Date;
}

View File

@@ -13,6 +13,7 @@ export class SelectOptionsController {
customerTypes: this.selectOptionsService.customerTypes,
locations: this.selectOptionsService.locations,
typesOfCommercialProperty: this.selectOptionsService.typesOfCommercialProperty,
customerSubTypes: this.selectOptionsService.customerSubTypes,
};
}
}

View File

@@ -41,9 +41,16 @@ export class SelectOptionsService {
];
public customerTypes: Array<KeyValue> = [
{ name: 'Buyer', value: 'buyer' },
{ name: 'Broker', value: 'broker' },
{ name: 'Professional', value: 'professional' },
];
public customerSubTypes: Array<KeyValue> = [
{ name: 'Broker', value: 'broker' },
{ name: 'CPA', value: 'cpa' },
{ name: 'Attorney', value: 'attorney' },
{ name: 'Title Company', value: 'titleCompany' },
{ name: 'Surveyor', value: 'surveyor' },
{ name: 'Appraiser', value: 'appraiser' },
];
public gender: Array<KeyValue> = [
{ name: 'Male', value: 'male' },
{ name: 'Female', value: 'female' },