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 { RequestDurationMiddleware } from './request-duration/request-duration.middleware.js';
|
||||
import { SelectOptionsModule } from './select-options/select-options.module.js';
|
||||
import { SubscriptionsController } from './subscriptions/subscriptions.controller.js';
|
||||
|
||||
import { UserModule } from './user/user.module.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
|
@ -47,7 +47,7 @@ const __dirname = path.dirname(__filename);
|
|||
SelectOptionsModule,
|
||||
ImageModule,
|
||||
],
|
||||
controllers: [AppController, SubscriptionsController],
|
||||
controllers: [AppController],
|
||||
providers: [AppService, FileService],
|
||||
})
|
||||
export class AppModule {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import path, { join } from 'path';
|
|||
import sharp from 'sharp';
|
||||
import { fileURLToPath } from 'url';
|
||||
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 __dirname = path.dirname(__filename);
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ export class FileService {
|
|||
const rawData = readFileSync(filePath, 'utf8');
|
||||
this.subscriptions = JSON.parse(rawData);
|
||||
}
|
||||
getSubscriptions() {
|
||||
getSubscriptions(): Subscription[] {
|
||||
return this.subscriptions;
|
||||
}
|
||||
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 { User } from 'src/models/db.model.js';
|
||||
import { Logger } from 'winston';
|
||||
import { FileService } from '../file/file.service.js';
|
||||
import { Subscription } from '../models/main.model.js';
|
||||
import { UserService } from './user.service.js';
|
||||
|
||||
@Controller('user')
|
||||
export class UserController {
|
||||
constructor(
|
||||
private userService: UserService,
|
||||
private fileService: FileService,
|
||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||
) {}
|
||||
|
||||
|
|
@ -47,4 +50,16 @@ export class UserController {
|
|||
this.logger.info(`Found ${result.length} entries`);
|
||||
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 class="mr-5 mt-3">
|
||||
<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 class="mr-5 mt-3">
|
||||
<!-- <div class="mr-5 mt-3">
|
||||
<span class="font-medium text-500">Sold</span>
|
||||
<div class="text-700 mt-2">8</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="flex align-items-center mt-3">
|
||||
<!-- <span class="font-medium text-500">Logo</span> -->
|
||||
<div>
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
<div class="text-500 w-full md:w-2 font-medium">Licensed In</div>
|
||||
<div class="text-900 w-full md:w-10">
|
||||
@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>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -66,12 +66,13 @@
|
|||
<div class="grid">
|
||||
<div class="flex col-12 md:col-6">
|
||||
<p-dropdown
|
||||
[filter]="true"
|
||||
filterBy="name"
|
||||
id="states"
|
||||
[options]="selectOptions?.states"
|
||||
[(ngModel)]="areasServed.state"
|
||||
optionLabel="name"
|
||||
optionValue="value"
|
||||
[showClear]="true"
|
||||
placeholder="State"
|
||||
[ngStyle]="{ width: '100%' }"
|
||||
></p-dropdown>
|
||||
|
|
@ -94,12 +95,13 @@
|
|||
<div class="grid">
|
||||
<div class="flex col-12 md:col-6">
|
||||
<p-dropdown
|
||||
[filter]="true"
|
||||
filterBy="name"
|
||||
id="states"
|
||||
[options]="selectOptions?.states"
|
||||
[(ngModel)]="licensedIn.state"
|
||||
optionLabel="name"
|
||||
optionValue="value"
|
||||
[showClear]="true"
|
||||
placeholder="State"
|
||||
[ngStyle]="{ width: '100%' }"
|
||||
></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.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 { Observable } from 'rxjs';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Subscription } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SubscriptionsService {
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getAllSubscriptions():Observable<Subscription[]>{
|
||||
return this.http.get<Subscription[]>(`${this.apiBaseUrl}/bizmatch/subscriptions`);
|
||||
getAllSubscriptions(id: string): Observable<Subscription[]> {
|
||||
return this.http.get<Subscription[]>(`${this.apiBaseUrl}/bizmatch/user/subscriptions/${id}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue