imagePath changed
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { ImageType } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { emailToDirName } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
@@ -12,33 +12,32 @@ export class ImageService {
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
uploadImage(imageBlob: Blob, type: 'uploadPropertyPicture' | 'uploadCompanyLogo' | 'uploadProfile', imagePath: string) {
|
||||
const uploadUrl = `${this.apiBaseUrl}/bizmatch/image/${type}/${imagePath}`;
|
||||
uploadImage(imageBlob: Blob, type: 'uploadPropertyPicture' | 'uploadCompanyLogo' | 'uploadProfile', imagePath: string, serialId?: number) {
|
||||
let uploadUrl = `${this.apiBaseUrl}/bizmatch/image/${type}/${imagePath}`;
|
||||
if (type === 'uploadPropertyPicture') {
|
||||
uploadUrl = `${this.apiBaseUrl}/bizmatch/image/${type}/${imagePath}/${serialId}`;
|
||||
}
|
||||
const formData = new FormData();
|
||||
formData.append('file', imageBlob, 'image.png');
|
||||
|
||||
return this.http.post(uploadUrl, formData, {
|
||||
// headers: this.headers,
|
||||
//reportProgress: true,
|
||||
observe: 'events',
|
||||
});
|
||||
}
|
||||
async deleteUserImage(userid: string, type: ImageType, name?: string) {
|
||||
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/${type.delete}${userid}`));
|
||||
|
||||
async deleteListingImage(imagePath: string, serial: number, name?: string) {
|
||||
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/propertyPicture/${imagePath}/${serial}/${name}`));
|
||||
}
|
||||
async deleteListingImage(imagePath: string, name?: string) {
|
||||
return await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/propertyPicture/${imagePath}/${name}`));
|
||||
|
||||
async deleteLogoImagesById(email: string) {
|
||||
const adjustedEmail = emailToDirName(email);
|
||||
await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/logo/${adjustedEmail}`));
|
||||
}
|
||||
async getProfileImagesForUsers(userids: string[]) {
|
||||
return await lastValueFrom(this.http.get<[]>(`${this.apiBaseUrl}/bizmatch/image/profileImages/${userids.join(',')}`));
|
||||
async deleteProfileImagesById(email: string) {
|
||||
const adjustedEmail = emailToDirName(email);
|
||||
await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/profile/${adjustedEmail}`));
|
||||
}
|
||||
async getCompanyLogosForUsers(userids: string[]) {
|
||||
return await lastValueFrom(this.http.get<[]>(`${this.apiBaseUrl}/bizmatch/image/companyLogos/${userids.join(',')}`));
|
||||
}
|
||||
async deleteLogoImagesById(userid: string) {
|
||||
await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/logo/${userid}`));
|
||||
}
|
||||
async deleteProfileImagesById(userid: string) {
|
||||
await lastValueFrom(this.http.delete<[]>(`${this.apiBaseUrl}/bizmatch/image/profile/${userid}`));
|
||||
async getPropertyImages(imagePath: string, serial: number): Promise<string[]> {
|
||||
return await lastValueFrom(this.http.get<string[]>(`${this.apiBaseUrl}/bizmatch/image/${imagePath}/${serial}`));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user