feat: add snippet and test for supa db
This commit is contained in:
21
src/scripts/sp-snippet.ts
Normal file
21
src/scripts/sp-snippet.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Snippet } from '@/models-supa/snippet.ts';
|
||||
|
||||
const main = async () => {
|
||||
const snippet = await Snippet.findAndCountAll();
|
||||
|
||||
console.log(snippet.count);
|
||||
};
|
||||
|
||||
// main();
|
||||
|
||||
const addOne = async () => {
|
||||
const snippet = await Snippet.create({
|
||||
title: 'Hello',
|
||||
description: 'Hello World',
|
||||
snippet: 'console.log("Hello")',
|
||||
keyword: '!hello',
|
||||
user_id: '3f82e3ae-b7c2-4244-849f-d453f304b2f2',
|
||||
});
|
||||
console.log(snippet);
|
||||
};
|
||||
// await addOne();
|
||||
Reference in New Issue
Block a user