import { dataDelete, pgClients } from "@opengis/fastify-table/utils.js";

export default async function delMap({
    params = {}, pg = pgClients.client, user = {},
}, reply) {
    const { uid } = user;

    if (!uid) {
        return reply.status(401).send('unauthorized');
    }

    const row = await dataDelete({
        pg,
        id: params.id,
        table: 'gis.maps',
        uid,
    });
    return reply.status(200).send(row);
}