Merge pull request #254 from adityachandelgit/develop
Merge Develop into Master for the Release
This commit is contained in:
@@ -38,7 +38,7 @@ dependencies {
|
|||||||
|
|
||||||
// --- Database & Migration ---
|
// --- Database & Migration ---
|
||||||
implementation 'org.mariadb.jdbc:mariadb-java-client:3.5.3'
|
implementation 'org.mariadb.jdbc:mariadb-java-client:3.5.3'
|
||||||
implementation 'org.flywaydb:flyway-mysql:11.7.1'
|
implementation 'org.flywaydb:flyway-mysql:11.8.0'
|
||||||
|
|
||||||
// --- Security & Authentication ---
|
// --- Security & Authentication ---
|
||||||
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
|
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ spring:
|
|||||||
username: ${DATABASE_USERNAME:root}
|
username: ${DATABASE_USERNAME:root}
|
||||||
password: ${DATABASE_PASSWORD:${MYSQL_ROOT_PASSWORD}}
|
password: ${DATABASE_PASSWORD:${MYSQL_ROOT_PASSWORD}}
|
||||||
hikari:
|
hikari:
|
||||||
max-lifetime: 580000 # 580 seconds
|
max-lifetime: 580000 # 9.6 minutes (avoid DB-side connection cuts)
|
||||||
connection-test-query: SELECT 1
|
connection-test-query: SELECT 1
|
||||||
maximum-pool-size: 10
|
maximum-pool-size: 10 # Allows bursts
|
||||||
idle-timeout: 300000 # 5 minutes
|
minimum-idle: 1 # Shrinks when idle
|
||||||
|
idle-timeout: 300000 # 5 minutes before idle connections are closed
|
||||||
jpa:
|
jpa:
|
||||||
hibernate:
|
hibernate:
|
||||||
naming:
|
naming:
|
||||||
@@ -52,3 +53,8 @@ logging:
|
|||||||
com.adityachandel.booklore: ${LOG_LEVEL:INFO}
|
com.adityachandel.booklore: ${LOG_LEVEL:INFO}
|
||||||
org.apache.fontbox: ERROR
|
org.apache.fontbox: ERROR
|
||||||
org.apache.pdfbox: ERROR
|
org.apache.pdfbox: ERROR
|
||||||
|
org.quartz.core.QuartzScheduler: WARN
|
||||||
|
org.quartz.simpl.SimpleThreadPool: WARN
|
||||||
|
org.quartz.simpl.RAMJobStore: WARN
|
||||||
|
org.hibernate.orm.connections.pooling: WARN
|
||||||
|
org.springframework.security.config.annotation.authentication.configuration.InitializeUserDetailsBeanManagerConfigurer: ERROR
|
||||||
@@ -97,7 +97,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
|||||||
@ViewChild(BookTableComponent) bookTableComponent!: BookTableComponent;
|
@ViewChild(BookTableComponent) bookTableComponent!: BookTableComponent;
|
||||||
@ViewChild(BookFilterComponent) bookFilterComponent!: BookFilterComponent;
|
@ViewChild(BookFilterComponent) bookFilterComponent!: BookFilterComponent;
|
||||||
|
|
||||||
selectedFilter = new BehaviorSubject<{ type: string; value: any } | null>(null);
|
selectedFilter = new BehaviorSubject<Record<string, any> | null>(null);
|
||||||
protected resetFilterSubject = new Subject<void>();
|
protected resetFilterSubject = new Subject<void>();
|
||||||
|
|
||||||
protected userService = inject(UserService);
|
protected userService = inject(UserService);
|
||||||
@@ -257,43 +257,37 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
private sideBarFilter(bookState: BookState): Observable<BookState> {
|
private sideBarFilter(bookState: BookState): Observable<BookState> {
|
||||||
return this.selectedFilter.pipe(
|
return this.selectedFilter.pipe(
|
||||||
map(selectedFilter => {
|
map((activeFilters: Record<string, any[]> | null) => {
|
||||||
if (!selectedFilter) {
|
if (!activeFilters) {
|
||||||
return bookState;
|
return bookState;
|
||||||
}
|
}
|
||||||
let filteredBooks = bookState.books || [];
|
|
||||||
switch (selectedFilter.type) {
|
const filteredBooks = (bookState.books || []).filter(book => {
|
||||||
|
return Object.entries(activeFilters).every(([filterType, filterValues]) => {
|
||||||
|
if (!Array.isArray(filterValues) || filterValues.length === 0) return true;
|
||||||
|
|
||||||
|
switch (filterType) {
|
||||||
case 'author':
|
case 'author':
|
||||||
filteredBooks = filteredBooks.filter(book =>
|
return filterValues.every(val => book.metadata?.authors?.includes(val));
|
||||||
book.metadata?.authors?.some(author => author === selectedFilter.value)
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'category':
|
case 'category':
|
||||||
filteredBooks = filteredBooks.filter(book =>
|
return filterValues.every(val => book.metadata?.categories?.includes(val));
|
||||||
book.metadata?.categories?.some(category => category === selectedFilter.value)
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'publisher':
|
case 'publisher':
|
||||||
filteredBooks = filteredBooks.filter(book =>
|
return filterValues.every(val => book.metadata?.publisher === val);
|
||||||
book.metadata?.publisher === selectedFilter.value
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'award':
|
case 'award':
|
||||||
filteredBooks = filteredBooks.filter(book =>
|
return filterValues.every(val =>
|
||||||
book.metadata?.awards?.some(
|
book.metadata?.awards?.some(
|
||||||
award => award.name === selectedFilter.value.name && award.designation === 'WINNER'
|
award => award.name === val.name && award.designation === 'WINNER'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
case 'series':
|
case 'series':
|
||||||
filteredBooks = filteredBooks.filter(book =>
|
return filterValues.every(val => book.metadata?.seriesName === val);
|
||||||
book.metadata?.seriesName === selectedFilter.value
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
return {...bookState, books: filteredBooks};
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return { ...bookState, books: filteredBooks };
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -523,8 +517,8 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.bookFilterComponent.filterSelected.subscribe((item) => {
|
this.bookFilterComponent.filterSelected.subscribe((filters: Record<string, any> | null) => {
|
||||||
this.selectedFilter.next(item);
|
this.selectedFilter.next(filters);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.activatedRoute.queryParamMap.subscribe(paramMap => {
|
this.activatedRoute.queryParamMap.subscribe(paramMap => {
|
||||||
|
|||||||
+12
-2
@@ -1,13 +1,23 @@
|
|||||||
<div *ngIf="showFilters" class="w-[225px] ml-4 h-[calc(100vh-6.5rem)] rounded-xl bg-[var(--card-background)] overflow-hidden">
|
<div *ngIf="showFilters" class="w-[225px] ml-4 h-[calc(100vh-6.5rem)] rounded-xl bg-[var(--card-background)] overflow-hidden">
|
||||||
<p-accordion [value]="0">
|
<p-accordion [value]="0">
|
||||||
<p-accordion-panel *ngFor="let filterType of filterTypes; let i = index" [value]="i">
|
<p-accordion-panel *ngFor="let filterType of filterTypes; let i = index" [value]="i">
|
||||||
<p-accordion-header>{{ filterType | titlecase }}</p-accordion-header>
|
<p-accordion-header>
|
||||||
|
<span class="inline-flex items-center gap-1">
|
||||||
|
{{ filterType | titlecase }}
|
||||||
|
<span *ngIf="activeFilters[filterType]?.length" class="text-sm text-[var(--primary-color)]">
|
||||||
|
({{ activeFilters[filterType].length }})
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</p-accordion-header>
|
||||||
<p-accordion-content class="h-[40rem] !overflow-y-auto">
|
<p-accordion-content class="h-[40rem] !overflow-y-auto">
|
||||||
<div *ngIf="filterStreams[filterType] | async as filters">
|
<div *ngIf="filterStreams[filterType] | async as filters">
|
||||||
<div *ngFor="let filter of filters">
|
<div *ngFor="let filter of filters">
|
||||||
<p
|
<p
|
||||||
class="cursor-pointer transition-colors duration-200 ease-in-out pb-1"
|
class="cursor-pointer transition-colors duration-200 ease-in-out pb-1"
|
||||||
[ngClass]="{'text-[var(--primary-color)]': activeFilter.type === filterType && activeFilter.value === (filter.value?.id || filter.value)}"
|
[ngClass]="{
|
||||||
|
'text-[var(--primary-color)]':
|
||||||
|
activeFilters[filterType]?.includes(filter.value?.id || filter.value)
|
||||||
|
}"
|
||||||
(click)="handleFilterClick(filterType, filter.value?.id || filter.value)">
|
(click)="handleFilterClick(filterType, filter.value?.id || filter.value)">
|
||||||
<p-badge [value]="filter.bookCount"></p-badge>
|
<p-badge [value]="filter.bookCount"></p-badge>
|
||||||
{{ filter.value.name || filter.value }}
|
{{ filter.value.name || filter.value }}
|
||||||
|
|||||||
+21
-10
@@ -32,14 +32,14 @@ type Filter<T> = { value: T; bookCount: number };
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class BookFilterComponent implements OnInit {
|
export class BookFilterComponent implements OnInit {
|
||||||
@Output() filterSelected = new EventEmitter<{ type: string; value: any } | null>();
|
@Output() filterSelected = new EventEmitter<Record<string, any> | null>();
|
||||||
|
|
||||||
@Input() showFilters: boolean = true;
|
@Input() showFilters: boolean = true;
|
||||||
@Input() entity$!: Observable<Library | Shelf | null> | undefined;
|
@Input() entity$!: Observable<Library | Shelf | null> | undefined;
|
||||||
@Input() entityType$!: Observable<EntityType> | undefined;
|
@Input() entityType$!: Observable<EntityType> | undefined;
|
||||||
@Input() resetFilter$!: Subject<void>;
|
@Input() resetFilter$!: Subject<void>;
|
||||||
|
|
||||||
activeFilter: { type: string; value: any | null } = {type: '', value: null};
|
activeFilters: Record<string, any> = {};
|
||||||
filterStreams: Record<string, Observable<Filter<any>[]>> = {};
|
filterStreams: Record<string, Observable<Filter<any>[]>> = {};
|
||||||
filterTypes: string[] = [];
|
filterTypes: string[] = [];
|
||||||
|
|
||||||
@@ -91,18 +91,29 @@ export class BookFilterComponent implements OnInit {
|
|||||||
return books;
|
return books;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFilterClick(filterType: string, value: any) {
|
handleFilterClick(filterType: string, value: any): void {
|
||||||
if (this.activeFilter.type === filterType && this.activeFilter.value === value) {
|
if (!this.activeFilters[filterType]) {
|
||||||
this.activeFilter = {type: '', value: null};
|
this.activeFilters[filterType] = [];
|
||||||
this.filterSelected.emit(null);
|
|
||||||
} else {
|
|
||||||
this.activeFilter = {type: filterType, value};
|
|
||||||
this.filterSelected.emit({type: filterType, value});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const index = this.activeFilters[filterType].indexOf(value);
|
||||||
|
if (index > -1) {
|
||||||
|
// Deselect
|
||||||
|
this.activeFilters[filterType].splice(index, 1);
|
||||||
|
if (this.activeFilters[filterType].length === 0) {
|
||||||
|
delete this.activeFilters[filterType];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Select
|
||||||
|
this.activeFilters[filterType].push(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit updated filter state
|
||||||
|
this.filterSelected.emit({ ...this.activeFilters });
|
||||||
}
|
}
|
||||||
|
|
||||||
clearActiveFilter() {
|
clearActiveFilter() {
|
||||||
this.activeFilter = { type: '', value: null };
|
this.activeFilters = {};
|
||||||
this.filterSelected.emit(null);
|
this.filterSelected.emit(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -1,6 +1,6 @@
|
|||||||
<p-progressSpinner *ngIf="(bookState$ | async)?.loaded === false" styleClass="spinner center-spinner"></p-progressSpinner>
|
<div class="dashboard-container">
|
||||||
|
<p-progressSpinner *ngIf="(bookState$ | async)?.loaded === false" styleClass="spinner center-spinner"></p-progressSpinner>
|
||||||
<div class="dashboard" *ngIf="(bookState$ | async)?.loaded === true">
|
<div class="dashboard" *ngIf="(bookState$ | async)?.loaded === true">
|
||||||
<div>
|
<div>
|
||||||
<div class="dashboard-no-library" *ngIf="isLibrariesEmpty$ | async; else dashboardScroller">
|
<div class="dashboard-no-library" *ngIf="isLibrariesEmpty$ | async; else dashboardScroller">
|
||||||
<div *ngIf="(userService.userData$ | async)?.permissions as permissions">
|
<div *ngIf="(userService.userData$ | async)?.permissions as permissions">
|
||||||
@@ -40,8 +40,7 @@
|
|||||||
[books]="randomBooks$ | async"
|
[books]="randomBooks$ | async"
|
||||||
[title]="'Discover Random Reads'">
|
[title]="'Discover Random Reads'">
|
||||||
</app-dashboard-scroller>
|
</app-dashboard-scroller>
|
||||||
|
|
||||||
<p-divider></p-divider>
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
.dashboard-container {
|
||||||
|
height: calc(100vh - 6.7rem);
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.dashboard {
|
.dashboard {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {Library} from '../../book/model/library.model';
|
|||||||
import {LibraryService} from '../../book/service/library.service';
|
import {LibraryService} from '../../book/service/library.service';
|
||||||
import {Dialog} from 'primeng/dialog';
|
import {Dialog} from 'primeng/dialog';
|
||||||
import {Password} from 'primeng/password';
|
import {Password} from 'primeng/password';
|
||||||
import {Tooltip} from 'primeng/tooltip';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-management',
|
selector: 'app-user-management',
|
||||||
@@ -26,8 +25,7 @@ import {Tooltip} from 'primeng/tooltip';
|
|||||||
NgStyle,
|
NgStyle,
|
||||||
MultiSelect,
|
MultiSelect,
|
||||||
Dialog,
|
Dialog,
|
||||||
Password,
|
Password
|
||||||
Tooltip,
|
|
||||||
],
|
],
|
||||||
templateUrl: './user-management.component.html',
|
templateUrl: './user-management.component.html',
|
||||||
styleUrls: ['./user-management.component.scss'],
|
styleUrls: ['./user-management.component.scss'],
|
||||||
|
|||||||
Reference in New Issue
Block a user