lint: format and lint

This commit is contained in:
Julien Calixte
2026-02-09 12:03:03 +01:00
parent 878847b5d2
commit ed157cb4df
5 changed files with 27 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
import { Jetstream } from "@skyware/jetstream"; import { Jetstream } from "@skyware/jetstream";
import { upsertNote } from "./src/data/db" import { upsertNote } from "./src/data/db.ts";
const jetstream = new Jetstream({ const jetstream = new Jetstream({
wantedCollections: ["space.litenote.note"], wantedCollections: ["space.litenote.note"],
@@ -7,24 +7,26 @@ const jetstream = new Jetstream({
jetstream.onCreate("space.litenote.note", (event) => { jetstream.onCreate("space.litenote.note", (event) => {
console.log("create", event); console.log("create", event);
const {did, commit: {rkey, record}} = event const { did, commit: { rkey, record } } = event;
upsertNote({ upsertNote({
did, did,
rkey, rkey,
...record ...record,
} as any) // deno-lint-ignore no-explicit-any
} as any);
}); });
jetstream.onUpdate("space.litenote.note", (event) => { jetstream.onUpdate("space.litenote.note", (event) => {
console.log("update", event); console.log("update", event);
const {did, commit: {rkey, record}} = event const { did, commit: { rkey, record } } = event;
upsertNote({ upsertNote({
did, did,
rkey, rkey,
...record ...record,
} as any) // deno-lint-ignore no-explicit-any
} as any);
}); });
jetstream.on("close", () => { jetstream.on("close", () => {

View File

@@ -1,9 +1,9 @@
import { DB } from "https://deno.land/x/sqlite/mod.ts"; import { DB } from "https://deno.land/x/sqlite/mod.ts";
import type { Note } from "./note" import type { Note } from "./note.ts";
export const db = new DB(Deno.env.get("SQLITE_PATH") ?? "notes.db"); export const db = new DB(Deno.env.get("SQLITE_PATH") ?? "notes.db");
export const upsertNote = async (note: Note) => { export const upsertNote = (note: Note) => {
db.query( db.query(
` `
INSERT INTO note ( INSERT INTO note (
@@ -30,4 +30,4 @@ export const upsertNote = async (note: Note) => {
note.rkey, note.rkey,
], ],
); );
} };

View File

@@ -1,8 +1,8 @@
export type Note = { export type Note = {
did: string did: string;
rkey: string rkey: string;
title: string title: string;
content: string content: string;
publishedAt: Date publishedAt: Date;
createdAt: Date createdAt: Date;
} };

View File

@@ -1,4 +1,4 @@
import { db } from "../data/db" import { db } from "../data/db";
db.execute(` db.execute(`
CREATE TABLE IF NOT EXISTS note ( CREATE TABLE IF NOT EXISTS note (