Compare commits

..

7 Commits

Author SHA1 Message Date
ee0e10072c updating version number 2026-04-26 17:19:20 -05:00
899f92f342 126 all logs shown when unauthenticated (#131)
* fixing all logs showing when user is unauthenticated

* updating api log interceptor

* updating api log interceptor

* updating api log interceptor

* logbook page unauthenticated alert
2026-04-26 17:08:34 -05:00
5c4245179f 126 all logs shown when unauthenticated (#130)
* fixing all logs showing when user is unauthenticated

* updating api log interceptor

* updating api log interceptor

* updating api log interceptor
2026-04-18 11:37:23 -07:00
a7a9f01fd9 126 all logs shown when unauthenticated (#129)
* fixing all logs showing when user is unauthenticated

* updating api log interceptor

* updating api log interceptor
2026-04-18 11:09:50 -07:00
a367b517db updating api log interceptor (#128)
* fixing all logs showing when user is unauthenticated

* updating api log interceptor
2026-04-16 06:31:28 -07:00
fd514e4c8b fixing all logs showing when user is unauthenticated (#127) 2026-04-07 20:44:21 -05:00
d8513e6dd0 fixing logbook skip take order by (#125) 2026-03-23 20:19:58 -05:00
7 changed files with 33 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "api",
"version": "2.1.1",
"version": "2.1.4",
"description": "",
"author": "",
"private": true,

View File

@@ -62,8 +62,8 @@ export class LogInterceptor implements NestInterceptor {
const logs = publicData.slice(0, 5)
return {
entities: publicData,
total: data.total,
entities: logs,
total: logs.length,
hasNextPage: false
};
} else {
@@ -71,7 +71,6 @@ export class LogInterceptor implements NestInterceptor {
return publicData
}
}
})
);

View File

@@ -234,14 +234,14 @@ describe('LogService', () => {
const count = 1
const morePages = false
jest.spyOn(mockLogRepository, 'findAndCount').mockReturnValue([logs, count, morePages]);
jest.spyOn(mockQueryBuilder, 'getManyAndCount').mockReturnValue([logs, count, morePages]);
const {entities, total, hasNextPage} = await service.findLogsWithCount();
expect(entities).toEqual(logs);
expect(count).toEqual(total);
expect(hasNextPage).toEqual(morePages);
expect(mockLogRepository.findAndCount).toHaveBeenCalled();
expect(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
})
it('findLogsWithTracks => should find log entries with tracks', async () => {
@@ -294,7 +294,7 @@ describe('LogService', () => {
expect(entities).toEqual(logs);
expect(count).toEqual(total);
expect(hasNextPage).toEqual(morePages);
expect(mockLogRepository.findAndCount).toHaveBeenCalled();
expect(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
})
it('update => should update a log entry', async () => {

View File

@@ -25,11 +25,22 @@ export class LogService {
}
async findLogsWithCount(skip?: number, take?: number): Promise<Logs> {
const [entities, total] = await this.logRepository.findAndCount({
take,
skip,
relations: ['pilot', 'tracks']
})
// const [entities, total] = await this.logRepository.findAndCount({
// take,
// skip,
// order: {
// date: 'DESC'
// },
// relations: ['pilot', 'tracks']
// })
const [entities, total] = await this.logRepository
.createQueryBuilder('logs')
.innerJoinAndSelect('logs.pilot', 'pilot')
.orderBy('logs.date', 'DESC')
.skip(skip)
.take(take)
.getManyAndCount()
return {
entities,

View File

@@ -1,7 +1,7 @@
{
"name": "client",
"private": true,
"version": "2.1.1",
"version": "2.1.4",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -380,13 +380,13 @@ const Logbook: React.FC<unknown> = () => {
setPageIndex
} = table;
const getLogbookEntries = async (pageIndex?: number, pageSize?: number) => {
const getLogbookEntries = async (pageIndex: number, pageSize: number) => {
try {
dispatch({ type: 'SET_IS_LOADING', payload: true });
const response: AxiosResponse = await httpClient.get(`api/logs`, {
params: {
skip: pageIndex,
skip: pageIndex * pageSize,
take: pageSize
}
});
@@ -413,7 +413,7 @@ const Logbook: React.FC<unknown> = () => {
setColumnVisibility(columnVisibility)
dispatch({ type: 'SET_ENTRIES', payload: { entries: entries, totalEntries: response.data.total }});
if (!isUserLoggedIn && response.data.length >= 5) {
if (!isUserLoggedIn && response.data.entities.length >= 5) {
dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'A limited number of log entries displayed. Sign in to view all log entries.'}})
} else {
dispatch({ type: 'SET_ALERT', payload: undefined})
@@ -527,6 +527,10 @@ const Logbook: React.FC<unknown> = () => {
dispatch({ type: 'SET_PAGES', payload: pages })
}, [state.totalEntries, state.pagination?.pageSize])
useEffect(() => {
console.log(state.alert)
}, [state.alert])
return (
<>
<div className={`${screenSize === ScreenSize.SM ? 'mr-4 ml-4' : 'mr-10 ml-10'} grid grid-cols-12`}>
@@ -550,7 +554,7 @@ const Logbook: React.FC<unknown> = () => {
onClose={() =>
dispatch({ type: 'SET_ALERT', payload: undefined })
}
severity={'info'}
severity={state.alert.severity}
>
{state.alert.message}
</Alert>
@@ -569,7 +573,7 @@ const Logbook: React.FC<unknown> = () => {
>
<option value={10}>10</option>
<option value={25}>25</option>
<option value={3}>50</option>
<option value={50}>50</option>
<option value={state.totalEntries}>All</option>
</select>
</label>

View File

@@ -1,6 +1,6 @@
{
"name": "@noahspan/flying",
"version": "2.1.1",
"version": "2.1.4",
"scripts": {
"start": "node api/dist/main",
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",