sistema-de-chamados/convex
2025-10-24 00:45:41 -03:00
..
_generated feat: expand admin companies and users modules 2025-10-22 01:27:43 -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: 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 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 fix(machines): hydrate company name without slug flash 2025-10-22 22:39:17 -03:00
migrations.ts feat(tickets): preserve requester/assignee/company snapshots + timeline fallbacks; chore: add requester index\n\n- Add requesterSnapshot, assigneeSnapshot, companySnapshot to tickets\n- Use snapshots as fallback in list/get/play\n- Update snapshots on assignee changes/startWork\n- Preserve snapshots before deleting users/companies\n- Add index tickets.by_tenant_requester\n- Add migrations.backfillTicketSnapshots\n\nchore(convex): upgrade to ^1.28.0 and run codegen\nchore(next): upgrade Next.js to 15.5.6 and update React/eslint-config-next\nfix: remove any and lint warnings; tighten types across API routes and components\ndocs: add docs/ticket-snapshots.md 2025-10-20 10:13:37 -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 ci(convex): touch convex/README to trigger Convex deploy job 2025-10-20 15:35:48 -03:00
reports.ts fix(reports): gate report queries behind staff check; prevent non-staff crashes; trigger Convex deploy by touching convex/reports.ts 2025-10-21 14:29:31 -03:00
revision.ts chore(convex): bump revision to force functions deploy 2025-10-21 11:34:14 -03:00
schema.ts feat: expand admin companies and users modules 2025-10-22 01:27:43 -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 feat: improve requester combobox and admin cleanup flows 2025-10-24 00:45:41 -03:00
tsconfig.json chore: reorganize project structure and ensure default queues 2025-10-06 22:59:35 -03:00
users.ts Permite selecionar solicitante e empresa nos tickets 2025-10-23 17:47:23 -03:00

Welcome to your Convex functions directory!

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

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.