mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 13:49:09 +03:00
24 lines
509 B
TypeScript
24 lines
509 B
TypeScript
import { SqlSnippets, UserContent } from 'types'
|
|
import { NEW_SQL_SNIPPET_SKELETON } from './SqlEditor.constants'
|
|
|
|
export const createSqlSnippetSkeleton = ({
|
|
name,
|
|
sql,
|
|
owner_id,
|
|
}: {
|
|
name?: string
|
|
sql?: string
|
|
owner_id?: number
|
|
} = {}): UserContent<SqlSnippets.Content> => {
|
|
return {
|
|
...NEW_SQL_SNIPPET_SKELETON,
|
|
...(name && { name }),
|
|
...(owner_id && { owner_id }),
|
|
content: {
|
|
...NEW_SQL_SNIPPET_SKELETON.content,
|
|
content_id: '',
|
|
sql: sql ?? '',
|
|
},
|
|
}
|
|
}
|