Skip to content

Commit

Permalink
Merge branch 'dev' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri-Levy committed Aug 9, 2023
2 parents 4865678 + 18d4f53 commit 1a55535
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 27 deletions.
16 changes: 12 additions & 4 deletions apps/backoffice-v2/src/common/components/molecules/Map/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { FunctionComponent } from 'react';
import { LatLngTuple } from 'leaflet';
import { AlertDescription } from '../../atoms/Alert/Alert.Description';
import L, { LatLngTuple } from 'leaflet';
import icon from 'leaflet/dist/images/marker-icon.png';
import iconShadow from 'leaflet/dist/images/marker-shadow.png';
import { MapContainer, Marker, Popup, TileLayer } from 'react-leaflet';

import { AlertDescription } from '../../atoms/Alert/Alert.Description';
import { IMapProps } from './interfaces';

export const Map: FunctionComponent<IMapProps> = ({ latitude, longitude, popupContent }) => {
const position: LatLngTuple = [latitude, longitude];

if (!latitude || !longitude) {
return <AlertDescription>Invalid coordinates.</AlertDescription>;
}

const position: LatLngTuple = [latitude, longitude];

L.Marker.prototype.options.icon = L.icon({
iconUrl: icon,
shadowUrl: iconShadow,
});

return (
<MapContainer center={position} zoom={13} className={`mt-6 h-[600px] rounded-md`}>
<TileLayer
Expand Down
64 changes: 45 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ export class RequestIdMiddleware implements NestMiddleware {
delete cleanHeaders.authorization;
delete cleanHeaders.cookie;

this.cls.set('requestId', request.id);
try {
this.cls.set('requestId', request.id);
} catch (e) {
// Mainly for debugging purposes. See https://github.com/Papooch/nestjs-cls/issues/67
this.logger.log('Could not set requestId');
}

this.logger.log(`Incoming request`, {
request: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ describe('UserSessionAuditMiddleware', () => {
});

it('will not be changed when lastActiveAt not expired', async () => {
const nonExpiredDate = dayjs().subtract(middleware.UPDATE_INTERVAL - 10, 'ms');
const nonExpiredDateString = dayjs()
.subtract(middleware.UPDATE_INTERVAL - 10, 'ms')
.toISOString();

testUser = await userService.updateById(testUser.id, {
data: { lastActiveAt: nonExpiredDate.toDate() },
data: { lastActiveAt: nonExpiredDateString },
});

await middleware.use(
Expand All @@ -109,7 +111,7 @@ describe('UserSessionAuditMiddleware', () => {

const user = await userService.getById(testUser.id);

expect(Number(user.lastActiveAt)).toEqual(Number(nonExpiredDate));
expect(user.lastActiveAt?.toISOString()).toBe(nonExpiredDateString);
expect(callback).toBeCalledTimes(1);
});

Expand Down

0 comments on commit 1a55535

Please sign in to comment.