Externalize audit pipeline services
This commit is contained in:
@@ -15,8 +15,9 @@ const auditStatus = v.union(
|
||||
);
|
||||
const usedSkillsValidator = v.array(
|
||||
v.object({
|
||||
id: v.optional(v.string()),
|
||||
name: v.string(),
|
||||
category: v.string(),
|
||||
category: v.optional(v.string()),
|
||||
version: v.optional(v.string()),
|
||||
source: v.optional(v.string()),
|
||||
}),
|
||||
@@ -179,6 +180,8 @@ export const create = mutation({
|
||||
ctaType: v.optional(v.string()),
|
||||
},
|
||||
handler: async (ctx, args) => {
|
||||
await requireOperator(ctx);
|
||||
|
||||
const now = Date.now();
|
||||
const existing = await ctx.db
|
||||
.query("audits")
|
||||
@@ -201,6 +204,8 @@ export const create = mutation({
|
||||
export const getDetail = query({
|
||||
args: { id: v.id("audits") },
|
||||
handler: async (ctx, args) => {
|
||||
await requireOperator(ctx);
|
||||
|
||||
const audit = await ctx.db.get(args.id);
|
||||
if (!audit) {
|
||||
return null;
|
||||
@@ -214,6 +219,8 @@ export const getDetail = query({
|
||||
export const get = query({
|
||||
args: { id: v.id("audits") },
|
||||
handler: async (ctx, args) => {
|
||||
await requireOperator(ctx);
|
||||
|
||||
return await ctx.db.get(args.id);
|
||||
},
|
||||
});
|
||||
@@ -302,6 +309,8 @@ export const upsertFromAuditGeneration = internalMutation({
|
||||
export const getBySlug = query({
|
||||
args: { slug: v.string() },
|
||||
handler: async (ctx, args) => {
|
||||
await requireOperator(ctx);
|
||||
|
||||
const audits = await ctx.db
|
||||
.query("audits")
|
||||
.withIndex("by_slug", (q) => q.eq("slug", args.slug))
|
||||
@@ -496,6 +505,8 @@ export const list = query({
|
||||
limit: v.optional(v.number()),
|
||||
},
|
||||
handler: async (ctx, args) => {
|
||||
await requireOperator(ctx);
|
||||
|
||||
const limit = normalizeListLimit(args.limit);
|
||||
|
||||
if (args.leadId) {
|
||||
|
||||
Reference in New Issue
Block a user