mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-26 02:21:06 -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
20 lines
574 B
TypeScript
20 lines
574 B
TypeScript
import {Row as rowFor, run} from 'common/supabase/utils'
|
|
import {db} from 'web/lib/supabase/db'
|
|
|
|
export const deleteAnswer = async (
|
|
answer: rowFor<'compatibility_answers_free'>,
|
|
userId?: string,
|
|
) => {
|
|
if (!userId || answer.creator_id !== userId) return
|
|
await run(
|
|
db.from('compatibility_answers_free').delete().match({id: answer.id, creator_id: userId}),
|
|
)
|
|
}
|
|
|
|
export const getOtherAnswers = async (question_id: number) => {
|
|
const {data} = await db.rpc('get_compatibility_answers_and_profiles' as any, {
|
|
p_question_id: question_id,
|
|
})
|
|
return data
|
|
}
|