validatedCity, mask for input, confirmatonService, Version Info,
This commit is contained in:
@@ -7,12 +7,14 @@ import { join } from 'path';
|
||||
import pkg from 'pg';
|
||||
import { rimraf } from 'rimraf';
|
||||
import sharp from 'sharp';
|
||||
import { Geo } from 'src/models/server.model.js';
|
||||
import winston from 'winston';
|
||||
import { BusinessListing, CommercialPropertyListing, User, UserData } from '../models/db.model.js';
|
||||
import { createDefaultUser, emailToDirName, KeyValueStyle } from '../models/main.model.js';
|
||||
import { SelectOptionsService } from '../select-options/select-options.service.js';
|
||||
import { toDrizzleUser } from '../utils.js';
|
||||
import { convertUserToDrizzleUser } from '../utils.js';
|
||||
import * as schema from './schema.js';
|
||||
|
||||
const typesOfBusiness: Array<KeyValueStyle> = [
|
||||
{ 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' },
|
||||
@@ -47,7 +49,7 @@ await db.delete(schema.businesses);
|
||||
await db.delete(schema.users);
|
||||
let filePath = `./src/assets/geo.json`;
|
||||
const rawData = readFileSync(filePath, 'utf8');
|
||||
const geos = JSON.parse(rawData);
|
||||
const geos = JSON.parse(rawData) as Geo;
|
||||
|
||||
const sso = new SelectOptionsService();
|
||||
//Broker
|
||||
@@ -94,28 +96,22 @@ for (let index = 0; index < usersData.length; index++) {
|
||||
user.companyName = userData.companyName;
|
||||
user.companyOverview = userData.companyOverview;
|
||||
user.companyWebsite = userData.companyWebsite;
|
||||
user.companyLocation = userData.companyLocation;
|
||||
const [city, state] = user.companyLocation.split('-').map(e => e.trim());
|
||||
const [city, state] = userData.companyLocation.split('-').map(e => e.trim());
|
||||
user.companyLocation.city = city;
|
||||
user.companyLocation.state = state;
|
||||
const cityGeo = geos.states.find(s => s.state_code === state).cities.find(c => c.name === city);
|
||||
user.latitude = cityGeo.latitude;
|
||||
user.longitude = cityGeo.longitude;
|
||||
user.companyLocation.latitude = cityGeo.latitude;
|
||||
user.companyLocation.longitude = cityGeo.longitude;
|
||||
user.offeredServices = userData.offeredServices;
|
||||
user.gender = userData.gender;
|
||||
user.customerType = 'professional';
|
||||
user.customerSubType = 'broker';
|
||||
user.created = new Date();
|
||||
user.updated = new Date();
|
||||
// const createUserProfile = (user: User): UserProfile => {
|
||||
// const { id, created, updated, hasCompanyLogo, hasProfile, ...userProfile } = user;
|
||||
// return userProfile;
|
||||
// };
|
||||
// const userProfile = createUserProfile(user);
|
||||
// logger.info(`${index} - ${JSON.stringify(userProfile)}`);
|
||||
// const embedding = await createEmbedding(JSON.stringify(userProfile));
|
||||
//sleep(200);
|
||||
|
||||
const u = await db
|
||||
.insert(schema.users)
|
||||
.values(toDrizzleUser(user))
|
||||
.values(convertUserToDrizzleUser(user))
|
||||
.returning({ insertedId: schema.users.id, gender: schema.users.gender, email: schema.users.email, firstname: schema.users.firstname, lastname: schema.users.lastname });
|
||||
generatedUserData.push(u[0]);
|
||||
i++;
|
||||
|
||||
Reference in New Issue
Block a user