sistema-de-chamados/convex
rever-tecnologia 6007cf6740 Fix USB policy token hash bug
The getPendingUsbPolicy and reportUsbPolicyStatus functions were
comparing the plain token against the tokenHash in the database,
which would never match. Now properly hashing the token before
database lookup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 09:12:30 -03:00
..
_generated Add equipment loan feature and USB bulk control 2025-12-04 14:23:58 -03:00
alerts.ts refactor: quality workflow, docs, tests 2025-10-16 19:14:46 -03:00
bootstrap.ts feat: melhorar gerenciamento de acesso remoto de máquinas 2025-10-28 11:45:16 -03:00
categories.ts chore: sync staging 2025-11-10 01:57:45 -03:00
categorySlas.ts feat: agenda polish, SLA sync, filters 2025-11-08 02:34:43 -03:00
commentTemplates.ts feat: improve ticket export and navigation 2025-10-13 00:08:18 -03:00
companies.ts feat: expand admin companies and users modules 2025-10-22 01:27:43 -03:00
convex.config.ts chore: trigger convex rebuild 2025-10-22 02:16:32 -03:00
crons.ts Add USB policy improvements and emprestimos details modal 2025-12-05 08:24:56 -03:00
dashboards.ts feat: padroniza tickets recentes nos dashboards 2025-11-07 14:22:14 -03:00
deviceExportTemplates.ts Ajusta placeholders, formulários e widgets 2025-11-06 23:13:41 -03:00
deviceFieldDefaults.ts Ajusta placeholders, formulários e widgets 2025-11-06 23:13:41 -03:00
deviceFields.ts Ajusta placeholders, formulários e widgets 2025-11-06 23:13:41 -03:00
devices.ts feat: dispositivos e ajustes de csat e relatórios 2025-11-03 19:29:50 -03:00
emprestimos.ts Add USB policy improvements and emprestimos details modal 2025-12-05 08:24:56 -03:00
fields.ts chore: prep platform improvements 2025-11-09 21:09:38 -03:00
files.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
incidents.ts chore: sync staging 2025-11-10 01:57:45 -03:00
invites.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
machines.ts Add USB policy improvements and emprestimos details modal 2025-12-05 08:24:56 -03:00
metrics.ts fix: avoid multiple paginated queries in metrics 2025-11-18 20:08:30 -03:00
migrations.ts chore: prep platform improvements 2025-11-09 21:09:38 -03:00
queues.ts chore: prep platform improvements 2025-11-09 21:09:38 -03:00
rbac.ts docs: registrar fluxo do updater e atualizar chaves 2025-10-12 04:06:29 -03:00
README.md chore: trigger convex deploy 2025-11-17 16:02:12 -03:00
reports.ts fix: allow 90d analytics window 2025-11-19 16:02:37 -03:00
revision.ts chore(convex): bump revision to force functions deploy 2025-10-21 11:34:14 -03:00
schema.ts Add USB policy improvements and emprestimos details modal 2025-12-05 08:24:56 -03:00
seed.ts Reorganiza gestão de usuários e remove dados mock 2025-10-18 01:15:15 -03:00
slas.ts chore: prep platform improvements 2025-11-09 21:09:38 -03:00
teams.ts chore: prep platform improvements 2025-11-09 21:09:38 -03:00
ticketForms.config.ts chore: prep platform improvements 2025-11-09 21:09:38 -03:00
ticketFormSettings.ts Ajusta placeholders, formulários e widgets 2025-11-06 23:13:41 -03:00
ticketFormTemplates.ts chore: prep platform improvements 2025-11-09 21:09:38 -03:00
ticketNotifications.ts feat(export,tickets,forms,emails):\n- Corrige scroll de Dialogs e melhora UI de seleção de colunas (ícones e separador)\n- Ajusta rota/params da exportação em massa e adiciona modal de exportação individual\n- Renomeia 'Chamado padrão' para 'Chamado' e garante visibilidade total para admin/agente\n- Adiciona toggles por empresa/usuário para habilitar Admissão/Desligamento\n- Exibe badge do tipo de solicitação na listagem e no cabeçalho do ticket\n- Prepara notificações por e-mail (comentário público e encerramento) via SMTP\n 2025-11-04 13:41:32 -03:00
tickets.ts Expose visit status and performedAt in ticket list 2025-11-26 16:54:25 -03:00
tsconfig.json chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
usbPolicy.ts Fix USB policy token hash bug 2025-12-05 09:12:30 -03:00
users.ts feat: export reports as xlsx and add machine inventory 2025-10-27 18:00:28 -03:00

Welcome to your Convex functions directory!

CI note: touching a file under convex/** intentionally triggers the Convex deploy job. // minor note to bump convex deploy

Write your Convex functions here. See https://docs.convex.dev/functions for more.

A query function that takes two arguments looks like:

// convex/myFunctions.ts
import { query } from "./_generated/server";
import { v } from "convex/values";

export const myQueryFunction = query({
  // Validators for arguments.
  args: {
    first: v.number(),
    second: v.string(),
  },

  // Function implementation.
  handler: async (ctx, args) => {
    // Read the database as many times as you need here.
    // See https://docs.convex.dev/database/reading-data.
    const documents = await ctx.db.query("tablename").collect();

    // Arguments passed from the client are properties of the args object.
    console.log(args.first, args.second);

    // Write arbitrary JavaScript here: filter, aggregate, build derived data,
    // remove non-public properties, or create new objects.
    return documents;
  },
});

Using this query function in a React component looks like:

const data = useQuery(api.myFunctions.myQueryFunction, {
  first: 10,
  second: "hello",
});

A mutation function looks like:

// convex/myFunctions.ts
import { mutation } from "./_generated/server";
import { v } from "convex/values";

export const myMutationFunction = mutation({
  // Validators for arguments.
  args: {
    first: v.string(),
    second: v.string(),
  },

  // Function implementation.
  handler: async (ctx, args) => {
    // Insert or modify documents in the database here.
    // Mutations can also read from the database like queries.
    // See https://docs.convex.dev/database/writing-data.
    const message = { body: args.first, author: args.second };
    const id = await ctx.db.insert("messages", message);

    // Optionally, return a value from your mutation.
    return await ctx.db.get(id);
  },
});

Using this mutation function in a React component looks like:

const mutation = useMutation(api.myFunctions.myMutationFunction);
function handleButtonPress() {
  // fire and forget, the most common way to use mutations
  mutation({ first: "Hello!", second: "me" });
  // OR
  // use the result once the mutation has completed
  mutation({ first: "Hello!", second: "me" }).then((result) =>
    console.log(result),
  );
}

Use the Convex CLI to push your functions to a deployment. See everything the Convex CLI can do by running npx convex -h in your project root directory. To learn more, launch the docs with npx convex docs.