feature: new dashboard workos auth for dashboard login, dashboard optional in site config, sync server for dashboard, workos and dashboard docs updated

This commit is contained in:
Wayne Sutton
2025-12-29 22:11:52 -08:00
parent f6c9478c9d
commit e8d09fcce2
47 changed files with 15058 additions and 193 deletions

21
convex/auth.config.ts Normal file
View File

@@ -0,0 +1,21 @@
const clientId = process.env.WORKOS_CLIENT_ID;
const authConfig = {
providers: [
{
type: "customJwt",
issuer: `https://api.workos.com/`,
algorithm: "RS256",
jwks: `https://api.workos.com/sso/jwks/${clientId}`,
applicationID: clientId,
},
{
type: "customJwt",
issuer: `https://api.workos.com/user_management/${clientId}`,
algorithm: "RS256",
jwks: `https://api.workos.com/sso/jwks/${clientId}`,
},
],
};
export default authConfig;

View File

@@ -1,6 +1,57 @@
import { query, mutation } from "./_generated/server";
import { v } from "convex/values";
// Get all pages (published and unpublished) for dashboard admin view
export const listAll = query({
args: {},
returns: v.array(
v.object({
_id: v.id("pages"),
_creationTime: v.number(),
slug: v.string(),
title: v.string(),
content: v.string(),
published: v.boolean(),
order: v.optional(v.number()),
showInNav: v.optional(v.boolean()),
excerpt: v.optional(v.string()),
image: v.optional(v.string()),
featured: v.optional(v.boolean()),
featuredOrder: v.optional(v.number()),
authorName: v.optional(v.string()),
authorImage: v.optional(v.string()),
}),
),
handler: async (ctx) => {
const pages = await ctx.db.query("pages").collect();
// Sort by order, then by title
const sortedPages = pages.sort((a, b) => {
const orderA = a.order ?? 999;
const orderB = b.order ?? 999;
if (orderA !== orderB) return orderA - orderB;
return a.title.localeCompare(b.title);
});
return sortedPages.map((page) => ({
_id: page._id,
_creationTime: page._creationTime,
slug: page.slug,
title: page.title,
content: page.content,
published: page.published,
order: page.order,
showInNav: page.showInNav,
excerpt: page.excerpt,
image: page.image,
featured: page.featured,
featuredOrder: page.featuredOrder,
authorName: page.authorName,
authorImage: page.authorImage,
}));
},
});
// Get all published pages for navigation
export const getAllPages = query({
args: {},

View File

@@ -1,6 +1,58 @@
import { query, mutation, internalMutation, internalQuery } from "./_generated/server";
import { v } from "convex/values";
// Get all posts (published and unpublished) for dashboard admin view
export const listAll = query({
args: {},
returns: v.array(
v.object({
_id: v.id("posts"),
_creationTime: v.number(),
slug: v.string(),
title: v.string(),
description: v.string(),
content: v.string(),
date: v.string(),
published: v.boolean(),
tags: v.array(v.string()),
readTime: v.optional(v.string()),
image: v.optional(v.string()),
excerpt: v.optional(v.string()),
featured: v.optional(v.boolean()),
featuredOrder: v.optional(v.number()),
authorName: v.optional(v.string()),
authorImage: v.optional(v.string()),
}),
),
handler: async (ctx) => {
const posts = await ctx.db.query("posts").collect();
// Sort by date descending
const sortedPosts = posts.sort(
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime(),
);
return sortedPosts.map((post) => ({
_id: post._id,
_creationTime: post._creationTime,
slug: post.slug,
title: post.title,
description: post.description,
content: post.content,
date: post.date,
published: post.published,
tags: post.tags,
readTime: post.readTime,
image: post.image,
excerpt: post.excerpt,
featured: post.featured,
featuredOrder: post.featuredOrder,
authorName: post.authorName,
authorImage: post.authorImage,
}));
},
});
// Get all published posts, sorted by date descending
export const getAllPosts = query({
args: {},