pagination updates; fix subject name in lesson list
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"aud": "authenticated",
|
||||
"exp": 1772176558,
|
||||
"iat": 1772176498,
|
||||
"iss": "https://kind-burro-23.clerk.accounts.dev",
|
||||
"jti": "0689311f9e0ff06da236",
|
||||
"nbf": 1772176493,
|
||||
"role": "admin",
|
||||
"sub": "user_3AE7OSCzF8rz7XnvTkOUmFV4AKp"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
const latestMonday = new Date();
|
||||
const dayOfWeek = latestMonday.getDay();
|
||||
const daysSinceMonday = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
|
||||
latestMonday.setDate(latestMonday.getDate() - daysSinceMonday);
|
||||
latestMonday.setHours(0, 0, 0, 0);
|
||||
|
||||
const dayMap = { MONDAY: 0, TUESDAY: 1, WEDNESDAY: 2, THURSDAY: 3, FRIDAY: 4 };
|
||||
|
||||
function adjust(dayKey) {
|
||||
const targetDayOffset = dayMap[dayKey] || 0;
|
||||
|
||||
const targetDate = new Date(latestMonday);
|
||||
targetDate.setDate(latestMonday.getDate() + targetDayOffset);
|
||||
|
||||
const originalStart = new Date("2026-02-27T10:00:00Z"); // specific test time
|
||||
const adjustedStart = new Date(originalStart);
|
||||
|
||||
adjustedStart.setFullYear(
|
||||
targetDate.getFullYear(),
|
||||
targetDate.getMonth(),
|
||||
targetDate.getDate()
|
||||
);
|
||||
|
||||
console.log(dayKey, adjustedStart.toString());
|
||||
}
|
||||
|
||||
adjust("MONDAY");
|
||||
adjust("WEDNESDAY");
|
||||
adjust("FRIDAY");
|
||||
@@ -0,0 +1,19 @@
|
||||
import "dotenv/config";
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, "sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz");
|
||||
|
||||
async function main() {
|
||||
// 1. Get student 1 ID
|
||||
const { data: students } = await supabase.from("Student").select("id").limit(1);
|
||||
const studentId = students?.[0]?.id;
|
||||
console.log("Student ID:", studentId);
|
||||
|
||||
// 2. Execute SQL to simulate RLS
|
||||
const { data, error } = await supabase.rpc("simulate_rls_query", {
|
||||
jwt_claims: JSON.stringify({ sub: studentId, role: "student" }),
|
||||
query_table: "Lesson"
|
||||
});
|
||||
console.log("RPC Error:", error);
|
||||
// Wait, rpc might not exist. Let's just create a quick migration or do it directly.
|
||||
}
|
||||
main();
|
||||
@@ -0,0 +1,12 @@
|
||||
import "dotenv/config";
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!);
|
||||
|
||||
async function test() {
|
||||
const { data: { session }, error: authErr } = await supabase.auth.signInWithPassword({
|
||||
email: '[email protected]',
|
||||
password: '&%5C400l&%'
|
||||
});
|
||||
console.log("session:", session ? "success" : "failed", authErr);
|
||||
}
|
||||
test();
|
||||
@@ -0,0 +1,13 @@
|
||||
import "dotenv/config";
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.SUPABASE_SERVICE_ROLE_KEY!);
|
||||
|
||||
async function main() {
|
||||
const { data: students } = await supabase.from("Student").select("id").limit(1);
|
||||
const id = students?.[0]?.id;
|
||||
|
||||
// We can execute raw SQL using the rpc or we can just send it.
|
||||
// Wait, Supabase js doesn't support raw queries directly via the client without RPC.
|
||||
console.log("Student ID:", id);
|
||||
}
|
||||
main();
|
||||
@@ -0,0 +1,14 @@
|
||||
import "dotenv/config";
|
||||
import { clerkClient } from "@clerk/nextjs/server";
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
|
||||
async function main() {
|
||||
const clerk = clerkClient();
|
||||
const users = await clerk.users.getUserList({ query: "student1" });
|
||||
const user = users.data[0];
|
||||
|
||||
// We can't generate a true template JWT from backend clerkClient easily.
|
||||
// However, we can use clerkClient to check the user's publicMetadata.
|
||||
console.log("publicMetadata:", user.publicMetadata);
|
||||
}
|
||||
main();
|
||||
@@ -0,0 +1,2 @@
|
||||
const jwt = require('jsonwebtoken');
|
||||
console.log("Checking JWT format...");
|
||||
@@ -0,0 +1,2 @@
|
||||
const { createClient } = require('@supabase/supabase-js');
|
||||
// wait we don't have supabase js locally mapped easily to check schema, let's just use psql
|
||||
Reference in New Issue
Block a user