mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
* fix(server): Does not assign lat/lon if they are at 0,0 #2991 * Adds migration file to fix null island rows * Removed down migration * Leave empty down function
This commit is contained in:
@@ -23,6 +23,12 @@ describe('parsing latitude from string input', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('parsing latitude from null input', () => {
|
||||
it('returns null for null input', () => {
|
||||
expect(parseLatitude(null)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('parsing longitude from string input', () => {
|
||||
it('returns null for invalid inputs', () => {
|
||||
expect(parseLongitude('')).toBeNull();
|
||||
@@ -44,3 +50,9 @@ describe('parsing longitude from string input', () => {
|
||||
expect(parseLongitude('-0.0')).toBeCloseTo(-0.0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('parsing longitude from null input', () => {
|
||||
it('returns null for null input', () => {
|
||||
expect(parseLongitude(null)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { isNumberInRange } from '../numbers';
|
||||
|
||||
export function parseLatitude(input: string | number): number | null {
|
||||
export function parseLatitude(input: string | number | null): number | null {
|
||||
if (input === null) {
|
||||
return null;
|
||||
}
|
||||
const latitude = typeof input === 'string' ? Number.parseFloat(input) : input;
|
||||
|
||||
if (isNumberInRange(latitude, -90, 90)) {
|
||||
@@ -9,7 +12,11 @@ export function parseLatitude(input: string | number): number | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function parseLongitude(input: string | number): number | null {
|
||||
export function parseLongitude(input: string | number | null): number | null {
|
||||
if (input === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const longitude = typeof input === 'string' ? Number.parseFloat(input) : input;
|
||||
|
||||
if (isNumberInRange(longitude, -180, 180)) {
|
||||
|
||||
Reference in New Issue
Block a user