feat: add snippet and test for supa db

This commit is contained in:
2024-10-21 01:31:58 +08:00
parent 089f629096
commit 0eae9458c6
8 changed files with 177 additions and 40 deletions

21
src/scripts/sp-snippet.ts Normal file
View 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();