add missing deleted check

deepsource-autofix-76c6eb20
Dan Gowans 2023-01-19 14:31:58 -05:00
parent 285704daab
commit fcdd8f950e
3 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,3 @@
import type * as recordTypes from '../../types/recordTypes';
export declare function getMap(mapId: number | string): Promise<recordTypes.Map>;
export declare function getMap(mapId: number | string): Promise<recordTypes.Map | undefined>;
export default getMap;

View File

@ -13,6 +13,7 @@ export async function getMap(mapId) {
from Maps m
left join Lots l on m.mapId = l.mapId and l.recordDelete_timeMillis is null
where m.mapId = ?
and m.recordDelete_timeMillis is null
group by m.mapId, m.mapName, m.mapDescription,
m.mapLatitude, m.mapLongitude, m.mapSVG,
m.mapAddress1, m.mapAddress2, m.mapCity, m.mapProvince, m.mapPostalCode,

View File

@ -2,7 +2,9 @@ import { acquireConnection } from './pool.js'
import type * as recordTypes from '../../types/recordTypes'
export async function getMap(mapId: number | string): Promise<recordTypes.Map> {
export async function getMap(
mapId: number | string
): Promise<recordTypes.Map | undefined> {
const database = await acquireConnection()
const map: recordTypes.Map = database
@ -18,6 +20,7 @@ export async function getMap(mapId: number | string): Promise<recordTypes.Map> {
from Maps m
left join Lots l on m.mapId = l.mapId and l.recordDelete_timeMillis is null
where m.mapId = ?
and m.recordDelete_timeMillis is null
group by m.mapId, m.mapName, m.mapDescription,
m.mapLatitude, m.mapLongitude, m.mapSVG,
m.mapAddress1, m.mapAddress2, m.mapCity, m.mapProvince, m.mapPostalCode,