Bug Fixes
This commit is contained in:
parent
dc9adb151d
commit
214327031c
|
|
@ -14,7 +14,7 @@ import { ListingsModule } from './listings/listings.module.js';
|
||||||
import { MailModule } from './mail/mail.module.js';
|
import { MailModule } from './mail/mail.module.js';
|
||||||
import { RequestDurationMiddleware } from './request-duration/request-duration.middleware.js';
|
import { RequestDurationMiddleware } from './request-duration/request-duration.middleware.js';
|
||||||
import { SelectOptionsModule } from './select-options/select-options.module.js';
|
import { SelectOptionsModule } from './select-options/select-options.module.js';
|
||||||
import { SubscriptionsController } from './subscriptions/subscriptions.controller.js';
|
|
||||||
import { UserModule } from './user/user.module.js';
|
import { UserModule } from './user/user.module.js';
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
|
@ -47,7 +47,7 @@ const __dirname = path.dirname(__filename);
|
||||||
SelectOptionsModule,
|
SelectOptionsModule,
|
||||||
ImageModule,
|
ImageModule,
|
||||||
],
|
],
|
||||||
controllers: [AppController, SubscriptionsController],
|
controllers: [AppController],
|
||||||
providers: [AppService, FileService],
|
providers: [AppService, FileService],
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import path, { join } from 'path';
|
||||||
import sharp from 'sharp';
|
import sharp from 'sharp';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
import { ImageProperty } from '../models/main.model.js';
|
import { ImageProperty, Subscription } from '../models/main.model.js';
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ export class FileService {
|
||||||
const rawData = readFileSync(filePath, 'utf8');
|
const rawData = readFileSync(filePath, 'utf8');
|
||||||
this.subscriptions = JSON.parse(rawData);
|
this.subscriptions = JSON.parse(rawData);
|
||||||
}
|
}
|
||||||
getSubscriptions() {
|
getSubscriptions(): Subscription[] {
|
||||||
return this.subscriptions;
|
return this.subscriptions;
|
||||||
}
|
}
|
||||||
async storeProfilePicture(file: Express.Multer.File, userId: string) {
|
async storeProfilePicture(file: Express.Multer.File, userId: string) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import { Controller, Get } from '@nestjs/common';
|
|
||||||
import { FileService } from '../file/file.service.js';
|
|
||||||
|
|
||||||
@Controller('subscriptions')
|
|
||||||
export class SubscriptionsController {
|
|
||||||
constructor(private readonly fileService: FileService){}
|
|
||||||
@Get()
|
|
||||||
findAll(): any {
|
|
||||||
return this.fileService.getSubscriptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -2,12 +2,15 @@ import { Body, Controller, Get, Inject, Param, Post, Query } from '@nestjs/commo
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
import { User } from 'src/models/db.model.js';
|
import { User } from 'src/models/db.model.js';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
|
import { FileService } from '../file/file.service.js';
|
||||||
|
import { Subscription } from '../models/main.model.js';
|
||||||
import { UserService } from './user.service.js';
|
import { UserService } from './user.service.js';
|
||||||
|
|
||||||
@Controller('user')
|
@Controller('user')
|
||||||
export class UserController {
|
export class UserController {
|
||||||
constructor(
|
constructor(
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
|
private fileService: FileService,
|
||||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
@ -47,4 +50,16 @@ export class UserController {
|
||||||
this.logger.info(`Found ${result.length} entries`);
|
this.logger.info(`Found ${result.length} entries`);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('subscriptions/:id')
|
||||||
|
async findSubscriptionsById(@Param('id') id: string): Promise<Subscription[]> {
|
||||||
|
const subscriptions = this.fileService.getSubscriptions();
|
||||||
|
const user = await this.userService.getUserById(id);
|
||||||
|
subscriptions.forEach(s => {
|
||||||
|
s.userId = user.id;
|
||||||
|
s.start = user.created;
|
||||||
|
s.modified = user.created;
|
||||||
|
});
|
||||||
|
return subscriptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="mr-5 mt-3">
|
<div class="mr-5 mt-3">
|
||||||
<span class="font-medium text-500">For Sale</span>
|
<span class="font-medium text-500">For Sale</span>
|
||||||
<div class="text-700 mt-2">12</div>
|
<div class="text-700 mt-2">{{ businessListings.length + commercialPropListings.length }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mr-5 mt-3">
|
<!-- <div class="mr-5 mt-3">
|
||||||
<span class="font-medium text-500">Sold</span>
|
<span class="font-medium text-500">Sold</span>
|
||||||
<div class="text-700 mt-2">8</div>
|
<div class="text-700 mt-2">8</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="flex align-items-center mt-3">
|
<div class="flex align-items-center mt-3">
|
||||||
<!-- <span class="font-medium text-500">Logo</span> -->
|
<!-- <span class="font-medium text-500">Logo</span> -->
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Licensed In</div>
|
<div class="text-500 w-full md:w-2 font-medium">Licensed In</div>
|
||||||
<div class="text-900 w-full md:w-10">
|
<div class="text-900 w-full md:w-10">
|
||||||
@for (license of user.licensedIn; track license) {
|
@for (license of user.licensedIn; track license) {
|
||||||
<div>{{ license.state }} {{ license.registerNo }}</div>
|
<p-tag styleClass="mr-2" value="{{ license.registerNo }}-{{ license.state }}" [rounded]="true" severity="success"></p-tag>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,13 @@
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="flex col-12 md:col-6">
|
<div class="flex col-12 md:col-6">
|
||||||
<p-dropdown
|
<p-dropdown
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
id="states"
|
id="states"
|
||||||
[options]="selectOptions?.states"
|
[options]="selectOptions?.states"
|
||||||
[(ngModel)]="areasServed.state"
|
[(ngModel)]="areasServed.state"
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
[showClear]="true"
|
|
||||||
placeholder="State"
|
placeholder="State"
|
||||||
[ngStyle]="{ width: '100%' }"
|
[ngStyle]="{ width: '100%' }"
|
||||||
></p-dropdown>
|
></p-dropdown>
|
||||||
|
|
@ -94,12 +95,13 @@
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="flex col-12 md:col-6">
|
<div class="flex col-12 md:col-6">
|
||||||
<p-dropdown
|
<p-dropdown
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
id="states"
|
id="states"
|
||||||
[options]="selectOptions?.states"
|
[options]="selectOptions?.states"
|
||||||
[(ngModel)]="licensedIn.state"
|
[(ngModel)]="licensedIn.state"
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
[showClear]="true"
|
|
||||||
placeholder="State"
|
placeholder="State"
|
||||||
[ngStyle]="{ width: '100%' }"
|
[ngStyle]="{ width: '100%' }"
|
||||||
></p-dropdown>
|
></p-dropdown>
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export class AccountComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.userSubscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions());
|
this.userSubscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(this.user.id));
|
||||||
this.profileUrl = this.user.hasProfile ? `${this.env.imageBaseUrl}/pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
this.profileUrl = this.user.hasProfile ? `${this.env.imageBaseUrl}/pictures/profile/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||||
this.companyLogoUrl = this.user.hasCompanyLogo ? `${this.env.imageBaseUrl}/pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
this.companyLogoUrl = this.user.hasCompanyLogo ? `${this.env.imageBaseUrl}/pictures/logo/${this.user.id}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { environment } from '../../environments/environment';
|
|
||||||
import { HttpClient } from '@angular/common/http';
|
|
||||||
import { Subscription } from '../../../../bizmatch-server/src/models/main.model';
|
import { Subscription } from '../../../../bizmatch-server/src/models/main.model';
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class SubscriptionsService {
|
export class SubscriptionsService {
|
||||||
private apiBaseUrl = environment.apiBaseUrl;
|
private apiBaseUrl = environment.apiBaseUrl;
|
||||||
constructor(private http: HttpClient) { }
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
getAllSubscriptions():Observable<Subscription[]>{
|
getAllSubscriptions(id: string): Observable<Subscription[]> {
|
||||||
return this.http.get<Subscription[]>(`${this.apiBaseUrl}/bizmatch/subscriptions`);
|
return this.http.get<Subscription[]>(`${this.apiBaseUrl}/bizmatch/user/subscriptions/${id}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue