Compare commits
3 Commits
v2.1.3
...
122-fix-fl
| Author | SHA1 | Date | |
|---|---|---|---|
| 00cbe6eaa7 | |||
| 1ad064e41f | |||
| d7c584b391 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "api",
|
||||
"version": "2.1.3",
|
||||
"version": "2.1.1",
|
||||
"description": "",
|
||||
"author": "",
|
||||
"private": true,
|
||||
|
||||
@@ -62,7 +62,7 @@ export class LogInterceptor implements NestInterceptor {
|
||||
const logs = publicData.slice(0, 5)
|
||||
|
||||
return {
|
||||
entities: logs,
|
||||
entities: publicData,
|
||||
total: data.total,
|
||||
hasNextPage: false
|
||||
};
|
||||
@@ -71,6 +71,7 @@ export class LogInterceptor implements NestInterceptor {
|
||||
|
||||
return publicData
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -234,14 +234,14 @@ describe('LogService', () => {
|
||||
const count = 1
|
||||
const morePages = false
|
||||
|
||||
jest.spyOn(mockQueryBuilder, 'getManyAndCount').mockReturnValue([logs, count, morePages]);
|
||||
jest.spyOn(mockLogRepository, 'findAndCount').mockReturnValue([logs, count, morePages]);
|
||||
|
||||
const {entities, total, hasNextPage} = await service.findLogsWithCount();
|
||||
|
||||
expect(entities).toEqual(logs);
|
||||
expect(count).toEqual(total);
|
||||
expect(hasNextPage).toEqual(morePages);
|
||||
expect(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
|
||||
expect(mockLogRepository.findAndCount).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(mockQueryBuilder.getManyAndCount).toHaveBeenCalled();
|
||||
expect(mockLogRepository.findAndCount).toHaveBeenCalled();
|
||||
})
|
||||
|
||||
it('update => should update a log entry', async () => {
|
||||
|
||||
@@ -25,22 +25,11 @@ export class LogService {
|
||||
}
|
||||
|
||||
async findLogsWithCount(skip?: number, take?: number): Promise<Logs> {
|
||||
// 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()
|
||||
const [entities, total] = await this.logRepository.findAndCount({
|
||||
take,
|
||||
skip,
|
||||
relations: ['pilot', 'tracks']
|
||||
})
|
||||
|
||||
return {
|
||||
entities,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "client",
|
||||
"private": true,
|
||||
"version": "2.1.3",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -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 * pageSize,
|
||||
skip: pageIndex,
|
||||
take: pageSize
|
||||
}
|
||||
});
|
||||
@@ -527,10 +527,6 @@ const Logbook: React.FC<unknown> = () => {
|
||||
dispatch({ type: 'SET_PAGES', payload: pages })
|
||||
}, [state.totalEntries, state.pagination?.pageSize])
|
||||
|
||||
useEffect(() => {
|
||||
console.log(state.pagination)
|
||||
}, [state.pagination])
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`${screenSize === ScreenSize.SM ? 'mr-4 ml-4' : 'mr-10 ml-10'} grid grid-cols-12`}>
|
||||
@@ -573,7 +569,7 @@ const Logbook: React.FC<unknown> = () => {
|
||||
>
|
||||
<option value={10}>10</option>
|
||||
<option value={25}>25</option>
|
||||
<option value={50}>50</option>
|
||||
<option value={3}>50</option>
|
||||
<option value={state.totalEntries}>All</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@noahspan/flying",
|
||||
"version": "2.1.3",
|
||||
"version": "2.1.1",
|
||||
"scripts": {
|
||||
"start": "node api/dist/main",
|
||||
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",
|
||||
|
||||
Reference in New Issue
Block a user