sistema-de-chamados/convex
2025-10-19 03:03:10 -03:00
..
_generated feat: adicionar painel de máquinas e autenticação por agente 2025-10-07 21:37:41 -03:00
alerts.ts refactor: quality workflow, docs, tests 2025-10-16 19:14:46 -03:00
alerts_actions.ts convex: mover action de envio de alertas para arquivo Node ('alerts_actions.ts' com 'use node'); remover import de 'tls' do módulo de queries/mutations; ajustar cron para usar api.alerts_actions; remover tentativa de envio de e-mail no mutation addComment (evitar Node API em isolate). 2025-10-07 17:04:38 -03:00
bootstrap.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
categories.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
commentTemplates.ts feat: improve ticket export and navigation 2025-10-13 00:08:18 -03:00
companies.ts feat: sync convex companies and dashboard metrics 2025-10-18 21:14:01 -03:00
convex.config.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
crons.ts convex(cron): fornecer objeto de argumentos para action sendHoursUsageAlerts na crons.interval (TS2554) 2025-10-07 17:46:56 -03:00
fields.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
files.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
invites.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
machines.ts Atualiza portal e admin com bloqueio de máquinas desativadas 2025-10-18 00:02:15 -03:00
migrations.ts fix: align company data with machines 2025-10-18 21:57:13 -03:00
queues.ts feat: CSV exports, PDF improvements, play internal/external with hour split, roles cleanup, admin companies with 'Cliente avulso', ticket list spacing/alignment fixes, status translations and mappings 2025-10-07 13:42:45 -03:00
rbac.ts docs: registrar fluxo do updater e atualizar chaves 2025-10-12 04:06:29 -03:00
README.md chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
reports.ts feat: sync convex companies and dashboard metrics 2025-10-18 21:14:01 -03:00
schema.ts Atualiza portal e admin com bloqueio de máquinas desativadas 2025-10-18 00:02:15 -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: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
teams.ts chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
tickets.ts Allow managers to comment without assignee; keep assignee requirement for admin/agent; reflect in UI 2025-10-19 02:45:53 -03:00
tsconfig.json chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
users.ts Assignee picker: return only ADMIN/AGENT (exclude collaborators/managers) 2025-10-19 03:03:10 -03:00

Welcome to your Convex functions directory!

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.