checkpoint

This commit is contained in:
rizky 2024-10-21 01:58:09 -07:00
parent 32b55cf9e4
commit 6ba6245eb1
6 changed files with 50 additions and 7 deletions

View File

@ -99,8 +99,6 @@ export const FieldInput: FC<{
); );
} }
// console.log(prefix, suffix);
return ( return (
<div <div
className={cx( className={cx(

View File

@ -217,7 +217,6 @@ export const FieldTypeInput: FC<{
asSingle={true} asSingle={true}
useRange={false} useRange={false}
onChange={(value) => { onChange={(value) => {
// console.log({ value });
fm.data[field.name] = value?.startDate fm.data[field.name] = value?.startDate
? new Date(value?.startDate) ? new Date(value?.startDate)
: null; : null;

View File

@ -162,7 +162,6 @@ export const FieldUploadSingle: FC<{
<div <div
onClick={() => { onClick={() => {
if (input.ref) { if (input.ref) {
console.log(input.ref);
input.ref.click(); input.ref.click();
} }
}} }}

View File

@ -19,7 +19,6 @@ export const Login: FC<LGProps> = (props) => {
loadSession(); loadSession();
if (w.user) { if (w.user) {
const home = props.url_home[w.user.role]; const home = props.url_home[w.user.role];
console.log(home);
if (home) { if (home) {
location.href = getBasename() + home; location.href = getBasename() + home;
return; return;

View File

@ -73,8 +73,7 @@ Login is prevented, please logout first before re-login!`
if (this.current) { if (this.current) {
resolve(this.current); resolve(this.current);
} else { } else {
if (auth) { if (!auth) {
} else {
reject("Current session not found"); reject("Current session not found");
} }
} }

49
session/store/schema.ts Executable file
View File

@ -0,0 +1,49 @@
import { createId } from "@paralleldrive/cuid2";
import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const session = sqliteTable(
"session",
{
sid: text("sid")
.notNull()
.primaryKey()
.$defaultFn(() => createId()),
uid: text("uid").notNull(),
created_at: integer("created_at", { mode: "timestamp_ms" }).default(
new Date()
),
active: integer("active", { mode: "boolean" }),
data: text("data", { mode: "json" }).notNull(),
wsid: text("wsid", { mode: "json" }).default([]),
expired_at: integer("expired_at", { mode: "timestamp_ms" }),
},
(table) => {
return {
expired_at_idx: index("expired_at_idx").on(table.expired_at),
};
}
);
export const track = sqliteTable(
"track",
{
id: text("id")
.notNull()
.primaryKey()
.$defaultFn(() => createId()),
created_at: integer("created_at", { mode: "timestamp_ms" }).default(
new Date()
),
session_id: text("session_id"),
url: text("url").notNull(),
referer: text("referer"),
user_ip: text("user_ip"),
data: text("data", { mode: "json" }),
tstamp: integer("tstamp", { mode: "timestamp_ms" }).default(new Date()),
},
(table) => {
return {
session_id: index("session_id").on(table.session_id),
};
}
);