add embeddings, remove userId from business & commercialProperty replaced by email

This commit is contained in:
2024-07-13 19:44:07 +02:00
parent bf4bd69337
commit b7b34dacab
17 changed files with 123 additions and 763 deletions

View File

@@ -69,7 +69,7 @@ export class DetailsBusinessListingComponent {
this.history.push(event.urlAfterRedirects);
}
});
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
this.mailinfo = { sender: {}, email: '', url: environment.mailinfoUrl };
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
}
@@ -81,7 +81,7 @@ export class DetailsBusinessListingComponent {
this.mailinfo.sender = { name: `${this.user.firstname} ${this.user.lastname}`, email: this.user.email, phoneNumber: this.user.phoneNumber, state: this.user.companyLocation };
}
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'business'));
this.listingUser = await this.userService.getById(this.listing.userId);
this.listingUser = await this.userService.getByMail(this.listing.email);
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
}
@@ -90,7 +90,6 @@ export class DetailsBusinessListingComponent {
}
async mail() {
this.mailinfo.email = this.listingUser.email;
this.mailinfo.userId = this.listing.userId;
this.mailinfo.listing = this.listing;
await this.mailService.mail(this.mailinfo);
// this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Your message has been sent to the creator of the listing', life: 3000 });

View File

@@ -71,7 +71,7 @@ export class DetailsCommercialPropertyListingComponent {
private imageService: ImageService,
private ngZone: NgZone,
) {
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
this.mailinfo = { sender: {}, email: '', url: environment.mailinfoUrl };
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
}
@@ -84,7 +84,7 @@ export class DetailsCommercialPropertyListingComponent {
this.mailinfo.sender = { name: `${this.user.firstname} ${this.user.lastname}`, email: this.user.email, phoneNumber: this.user.phoneNumber, state: this.user.companyLocation };
}
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
this.listingUser = await this.userService.getById(this.listing.userId);
this.listingUser = await this.userService.getByMail(this.listing.email);
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
import('flowbite').then(flowbite => {
flowbite.initCarousels();
@@ -113,7 +113,6 @@ export class DetailsCommercialPropertyListingComponent {
}
async mail() {
this.mailinfo.email = this.listingUser.email;
this.mailinfo.userId = this.listing.userId;
this.mailinfo.listing = this.listing;
const result = await this.mailService.mail(this.mailinfo);
if (result) {

View File

@@ -85,7 +85,7 @@ export class EditBusinessListingComponent {
} else {
this.listing = createDefaultBusinessListing();
const listingUser = await this.userService.getByMail(keycloakUser.email);
this.listing.userId = listingUser.id;
this.listing.email = listingUser.email;
this.listing.imageName = emailToDirName(keycloakUser.email);
if (this.data) {
this.listing.title = this.data?.title;

View File

@@ -36,7 +36,6 @@ import { TOOLBAR_OPTIONS } from '../../utils/defaults';
styleUrl: './edit-commercial-property-listing.component.scss',
})
export class EditCommercialPropertyListingComponent {
// @ViewChild(FileUpload) public fileUpload: FileUpload;
@ViewChild('fileInput') fileInput!: ElementRef<HTMLInputElement>;
listingsCategory = 'commercialProperty';
@@ -125,7 +124,7 @@ export class EditCommercialPropertyListingComponent {
} else {
this.listing = createDefaultCommercialPropertyListing();
const listingUser = await this.userService.getByMail(keycloakUser.email);
this.listing.userId = listingUser.id;
this.listing.email = listingUser.email;
this.listing.imagePath = `${emailToDirName(keycloakUser.email)}`;
if (this.data) {
this.listing.title = this.data?.title;

View File

@@ -22,7 +22,7 @@ export class EmailUsComponent {
user: User;
errorResponse: ErrorResponse;
constructor(private mailService: MailService, private userService: UserService, public keycloakService: KeycloakService) {
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
this.mailinfo = { sender: {}, email: '', url: environment.mailinfoUrl };
}
async ngOnInit() {
const token = await this.keycloakService.getToken();

View File

@@ -31,7 +31,7 @@ export function createDefaultUser(email: string, firstname: string, lastname: st
export function createDefaultCommercialPropertyListing(): CommercialPropertyListing {
return {
id: undefined,
userId: '',
email: '',
type: null,
title: '',
description: '',
@@ -43,9 +43,6 @@ export function createDefaultCommercialPropertyListing(): CommercialPropertyList
draft: false,
zipCode: null,
county: '',
email: '',
website: '',
phoneNumber: '',
imageOrder: [],
imagePath: '',
created: null,
@@ -58,7 +55,6 @@ export function createDefaultCommercialPropertyListing(): CommercialPropertyList
export function createDefaultBusinessListing(): BusinessListing {
return {
id: undefined,
userId: '',
type: null,
title: '',
description: '',