feat: build local skills registry
This commit is contained in:
@@ -9,6 +9,14 @@ const auditStatus = v.union(
|
||||
v.literal("published"),
|
||||
v.literal("deactivated"),
|
||||
);
|
||||
const usedSkillsValidator = v.array(
|
||||
v.object({
|
||||
name: v.string(),
|
||||
category: v.string(),
|
||||
version: v.optional(v.string()),
|
||||
source: v.optional(v.string()),
|
||||
}),
|
||||
);
|
||||
|
||||
export const create = mutation({
|
||||
args: {
|
||||
@@ -16,6 +24,7 @@ export const create = mutation({
|
||||
slug: v.string(),
|
||||
checkedDomain: v.string(),
|
||||
checkedPages: v.array(v.string()),
|
||||
usedSkills: v.optional(usedSkillsValidator),
|
||||
status: v.optional(auditStatus),
|
||||
internalSummary: v.optional(v.string()),
|
||||
publicSummary: v.optional(v.string()),
|
||||
@@ -42,6 +51,19 @@ export const create = mutation({
|
||||
},
|
||||
});
|
||||
|
||||
export const getDetail = query({
|
||||
args: { id: v.id("audits") },
|
||||
handler: async (ctx, args) => {
|
||||
const audit = await ctx.db.get(args.id);
|
||||
if (!audit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const lead = await ctx.db.get(audit.leadId);
|
||||
return { audit, lead };
|
||||
},
|
||||
});
|
||||
|
||||
export const get = query({
|
||||
args: { id: v.id("audits") },
|
||||
handler: async (ctx, args) => {
|
||||
|
||||
Reference in New Issue
Block a user