forked from phc/website
chore: some changes and run prettier everywhere
This commit is contained in:
+4
-4
@@ -1,5 +1,5 @@
|
||||
import { drizzle } from "drizzle-orm/better-sqlite3";
|
||||
import Database from "better-sqlite3";
|
||||
import { drizzle } from 'drizzle-orm/better-sqlite3'
|
||||
import Database from 'better-sqlite3'
|
||||
|
||||
const sql = new Database("out/website.sqlite");
|
||||
export const db = drizzle(sql);
|
||||
const sql = new Database('out/website.sqlite')
|
||||
export const db = drizzle(sql)
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
|
||||
import { db } from "./index";
|
||||
import { migrate } from 'drizzle-orm/better-sqlite3/migrator'
|
||||
import { db } from './index'
|
||||
|
||||
migrate(db, { migrationsFolder: "out/drizzle" });
|
||||
migrate(db, { migrationsFolder: 'out/drizzle' })
|
||||
|
||||
+18
-18
@@ -1,9 +1,9 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import { text, sqliteTable } from "drizzle-orm/sqlite-core";
|
||||
import { sql } from 'drizzle-orm'
|
||||
import { text, sqliteTable } from 'drizzle-orm/sqlite-core'
|
||||
|
||||
export const users = sqliteTable("users", {
|
||||
export const users = sqliteTable('users', {
|
||||
// id è l'id unico di questo utente, non è modificabile una volta creato l'utente.
|
||||
id: text("id")
|
||||
id: text('id')
|
||||
.primaryKey()
|
||||
.default(sql`(lower(hex(randomblob(16))))`),
|
||||
|
||||
@@ -14,30 +14,30 @@ export const users = sqliteTable("users", {
|
||||
// chiesto se usare quello dell'account che sta usando o se cambiarlo
|
||||
// (in teoria non dovrebbe essere un problema poterlo modificare
|
||||
// successivamente).
|
||||
username: text("username").unique().notNull(),
|
||||
username: text('username').unique().notNull(),
|
||||
|
||||
// FullName da mostrare in giro per il sito
|
||||
fullName: text("fullname"),
|
||||
fullName: text('fullname'),
|
||||
|
||||
// Email per eventuale contatto
|
||||
email: text("email"),
|
||||
});
|
||||
email: text('email'),
|
||||
})
|
||||
|
||||
export type User = typeof users.$inferSelect; // return type when queried
|
||||
export type InsertUser = typeof users.$inferInsert; // insert type
|
||||
export type User = typeof users.$inferSelect // return type when queried
|
||||
export type InsertUser = typeof users.$inferInsert // insert type
|
||||
|
||||
export const accounts = sqliteTable("accounts", {
|
||||
export const accounts = sqliteTable('accounts', {
|
||||
// id è l'id unico di questo account, non è modificabile una volta creato l'account.
|
||||
id: text("id").primaryKey(),
|
||||
id: text('id').primaryKey(),
|
||||
|
||||
userId: text("userId")
|
||||
userId: text('userId')
|
||||
.notNull()
|
||||
.references(() => users.id),
|
||||
|
||||
provider: text("provider").$type<"poisson" | "ateneo">().notNull(),
|
||||
provider: text('provider').$type<'poisson' | 'ateneo'>().notNull(),
|
||||
|
||||
token: text("token").notNull(),
|
||||
});
|
||||
token: text('token').notNull(),
|
||||
})
|
||||
|
||||
export type Account = typeof accounts.$inferSelect; // return type when queried
|
||||
export type InsertAccount = typeof accounts.$inferInsert; // insert type
|
||||
export type Account = typeof accounts.$inferSelect // return type when queried
|
||||
export type InsertAccount = typeof accounts.$inferInsert // insert type
|
||||
|
||||
Reference in New Issue
Block a user