Helix
Helix
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Helix on 7/25/2024 in #questions
Auth Library Suggestions
10 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/25/2024 in #questions
Auth Library Suggestions
I've got lucia pretty much setup, but the ASWebAuthenticationSession is looking for a callback url, which I dont seem to be getting.
10 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/25/2024 in #questions
Auth Library Suggestions
The web end will be yes (besides having other functionality besides just auth), the on device is native swift.
10 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/24/2024 in #questions
NextAuth Callbacks
I’ve updated my callback url to the correct url and it’s returning the scheme and host but not the token
9 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/24/2024 in #questions
NextAuth Callbacks
9 replies
TTCTheo's Typesafe Cult
Created by Helix on 7/24/2024 in #questions
NextAuth Callbacks
I have added a accessToken return to the session callback method but I am not seeing any response on the iOS app
9 replies
DTDrizzle Team
Created by Helix on 7/18/2024 in #help
Querying Views
Nevermind, needed to add existing to the end of the schema definitioj
2 replies
DTDrizzle Team
Created by Helix on 7/12/2024 in #help
Drizzle and Turso not showing live data.
Weirdly enough I just made a test route
import { NextRequest, NextResponse } from 'next/server';
import { config } from "dotenv";
import { createClient } from '@libsql/client';

export const runtime = 'nodejs';

config({ path: ".env" });

export async function GET(req: NextRequest) {
const client = createClient({
url: process.env.TURSO_CONNECTION_URL!,
authToken: process.env.TURSO_AUTH_TOKEN!,
});

try {
const result = await client.execute('SELECT * FROM audits');
return NextResponse.json({ message: 'Connected to database', data: result.rows });
} catch (error) {
console.error('Error connecting to database:', error);
return NextResponse.json({ message: 'Error connecting to database' }, { status: 500 });
} finally {
await client.close();
}
}
import { NextRequest, NextResponse } from 'next/server';
import { config } from "dotenv";
import { createClient } from '@libsql/client';

export const runtime = 'nodejs';

config({ path: ".env" });

export async function GET(req: NextRequest) {
const client = createClient({
url: process.env.TURSO_CONNECTION_URL!,
authToken: process.env.TURSO_AUTH_TOKEN!,
});

try {
const result = await client.execute('SELECT * FROM audits');
return NextResponse.json({ message: 'Connected to database', data: result.rows });
} catch (error) {
console.error('Error connecting to database:', error);
return NextResponse.json({ message: 'Error connecting to database' }, { status: 500 });
} finally {
await client.close();
}
}
and it returns the updated data.
4 replies
DTDrizzle Team
Created by Helix on 7/12/2024 in #help
Drizzle and Turso not showing live data.
Any ideas?
4 replies
DTDrizzle Team
Created by Helix on 7/12/2024 in #help
Drizzle and Turso not showing live data.
import { config } from "dotenv";
import { drizzle } from "drizzle-orm/libsql";
import * as schema from "./schema";
import { createClient } from "@libsql/client";

config({ path: ".env" });

if (!process.env.TURSO_CONNECTION_URL || !process.env.TURSO_AUTH_TOKEN) {
throw new Error("Missing Turso environment variables");
}

console.log('Connecting to Turso database:', process.env.TURSO_CONNECTION_URL);

const client = createClient({
url: process.env.TURSO_CONNECTION_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
});

export const db = drizzle(client, {schema, logger: false});
import { config } from "dotenv";
import { drizzle } from "drizzle-orm/libsql";
import * as schema from "./schema";
import { createClient } from "@libsql/client";

config({ path: ".env" });

if (!process.env.TURSO_CONNECTION_URL || !process.env.TURSO_AUTH_TOKEN) {
throw new Error("Missing Turso environment variables");
}

console.log('Connecting to Turso database:', process.env.TURSO_CONNECTION_URL);

const client = createClient({
url: process.env.TURSO_CONNECTION_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
});

export const db = drizzle(client, {schema, logger: false});
This is my index.ts
import { sql } from "drizzle-orm";
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";

export const auditsTable = sqliteTable("audits", {
AUDIT_ID: text("AUDIT_ID")
.primaryKey()
.$default(() => sql`gen_random_uuid()`),
DATE: text("DATE").notNull(),
user: text("user").notNull(),
upc: text("upc").notNull(),
epc: text("epc").notNull(),
ex_upc: text("ex_upc").notNull(),
status: text("status", { enum: ["Pass", "Fail"] }).notNull(),
});

export type InsertAudit = typeof auditsTable.$inferInsert;
export type SelectAudit = typeof auditsTable.$inferSelect;
import { sql } from "drizzle-orm";
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";

export const auditsTable = sqliteTable("audits", {
AUDIT_ID: text("AUDIT_ID")
.primaryKey()
.$default(() => sql`gen_random_uuid()`),
DATE: text("DATE").notNull(),
user: text("user").notNull(),
upc: text("upc").notNull(),
epc: text("epc").notNull(),
ex_upc: text("ex_upc").notNull(),
status: text("status", { enum: ["Pass", "Fail"] }).notNull(),
});

export type InsertAudit = typeof auditsTable.$inferInsert;
export type SelectAudit = typeof auditsTable.$inferSelect;
and this is my schema.ts
4 replies