mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-03 22:44:35 -04:00
* Test * Add pretty formatting * Fix Tests * Fix Tests * Fix Tests * Fix * Add pretty formatting fix * Fix * Test * Fix tests * Clean typeckech * Add prettier check * Fix api tsconfig * Fix api tsconfig * Fix tsconfig * Fix * Fix * Prettier
25 lines
632 B
TypeScript
25 lines
632 B
TypeScript
import {createSupabaseDirectClient} from 'shared/supabase/init'
|
|
|
|
import {APIHandler} from './helpers/endpoint'
|
|
|
|
export const createBookmarkedSearch: APIHandler<'create-bookmarked-search'> = async (
|
|
props,
|
|
auth,
|
|
) => {
|
|
const creator_id = auth.uid
|
|
const {search_filters, location = null, search_name = null} = props
|
|
|
|
const pg = createSupabaseDirectClient()
|
|
|
|
const inserted = await pg.one(
|
|
`
|
|
INSERT INTO bookmarked_searches (creator_id, search_filters, location, search_name)
|
|
VALUES ($1, $2, $3, $4)
|
|
RETURNING *
|
|
`,
|
|
[creator_id, search_filters, location, search_name],
|
|
)
|
|
|
|
return inserted
|
|
}
|