Ajusta placeholders, formulários e widgets
This commit is contained in:
parent
343f0c8c64
commit
b94cea2f9a
33 changed files with 2122 additions and 462 deletions
|
|
@ -345,3 +345,28 @@ export const setDefault = mutation({
|
|||
})
|
||||
},
|
||||
})
|
||||
|
||||
export const clearCompanyDefault = mutation({
|
||||
args: {
|
||||
tenantId: v.string(),
|
||||
actorId: v.id("users"),
|
||||
companyId: v.id("companies"),
|
||||
},
|
||||
handler: async (ctx, { tenantId, actorId, companyId }) => {
|
||||
await requireAdmin(ctx, actorId, tenantId)
|
||||
const templates = await ctx.db
|
||||
.query("deviceExportTemplates")
|
||||
.withIndex("by_tenant_company", (q) => q.eq("tenantId", tenantId).eq("companyId", companyId))
|
||||
.collect()
|
||||
const now = Date.now()
|
||||
await Promise.all(
|
||||
templates.map((tpl) =>
|
||||
ctx.db.patch(tpl._id, {
|
||||
isDefault: false,
|
||||
updatedAt: now,
|
||||
updatedBy: actorId,
|
||||
})
|
||||
)
|
||||
)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue