refactor: remove access request functionality and related components
- Deleted the solicitacoesAcesso route and its associated components to streamline the dashboard. - Updated dashboard stats to remove references to access requests, ensuring accurate data representation. - Refactored backend queries to eliminate access request data handling, enhancing performance and maintainability. - Adjusted type definitions to reflect the removal of access request functionalities.
This commit is contained in:
@@ -7,8 +7,6 @@ export const getStats = query({
|
||||
returns: v.object({
|
||||
totalFuncionarios: v.number(),
|
||||
totalSimbolos: v.number(),
|
||||
totalSolicitacoesAcesso: v.number(),
|
||||
solicitacoesPendentes: v.number(),
|
||||
funcionariosAtivos: v.number(),
|
||||
funcionariosDesligados: v.number(),
|
||||
cargoComissionado: v.number(),
|
||||
@@ -42,19 +40,9 @@ export const getStats = query({
|
||||
const simbolos = await ctx.db.query("simbolos").collect();
|
||||
const totalSimbolos = simbolos.length;
|
||||
|
||||
// Contar solicitações de acesso
|
||||
const solicitacoes = await ctx.db.query("solicitacoesAcesso").collect();
|
||||
const totalSolicitacoesAcesso = solicitacoes.length;
|
||||
|
||||
const solicitacoesPendentes = solicitacoes.filter(
|
||||
(s) => s.status === "pendente"
|
||||
).length;
|
||||
|
||||
return {
|
||||
totalFuncionarios,
|
||||
totalSimbolos,
|
||||
totalSolicitacoesAcesso,
|
||||
solicitacoesPendentes,
|
||||
funcionariosAtivos,
|
||||
funcionariosDesligados,
|
||||
cargoComissionado,
|
||||
@@ -68,7 +56,6 @@ export const getRecentActivity = query({
|
||||
args: {},
|
||||
returns: v.object({
|
||||
funcionariosCadastrados24h: v.number(),
|
||||
solicitacoesAcesso24h: v.number(),
|
||||
simbolosCadastrados24h: v.number(),
|
||||
}),
|
||||
handler: async (ctx) => {
|
||||
@@ -81,11 +68,6 @@ export const getRecentActivity = query({
|
||||
(f) => f._creationTime >= last24h
|
||||
).length;
|
||||
|
||||
// Solicitações de acesso nas últimas 24h
|
||||
const solicitacoes = await ctx.db.query("solicitacoesAcesso").collect();
|
||||
const solicitacoesAcesso24h = solicitacoes.filter(
|
||||
(s) => s.dataSolicitacao >= last24h
|
||||
).length;
|
||||
|
||||
// Símbolos cadastrados nas últimas 24h
|
||||
const simbolos = await ctx.db.query("simbolos").collect();
|
||||
@@ -95,7 +77,6 @@ export const getRecentActivity = query({
|
||||
|
||||
return {
|
||||
funcionariosCadastrados24h,
|
||||
solicitacoesAcesso24h,
|
||||
simbolosCadastrados24h,
|
||||
};
|
||||
},
|
||||
@@ -137,15 +118,13 @@ export const getEvolucaoCadastros = query({
|
||||
v.object({
|
||||
mes: v.string(),
|
||||
funcionarios: v.number(),
|
||||
solicitacoes: v.number(),
|
||||
})
|
||||
),
|
||||
handler: async (ctx) => {
|
||||
const funcionarios = await ctx.db.query("funcionarios").collect();
|
||||
const solicitacoes = await ctx.db.query("solicitacoesAcesso").collect();
|
||||
|
||||
const now = new Date();
|
||||
const meses: Array<{ mes: string; funcionarios: number; solicitacoes: number }> = [];
|
||||
const meses: Array<{ mes: string; funcionarios: number }> = [];
|
||||
|
||||
// Últimos 6 meses
|
||||
for (let i = 5; i >= 0; i--) {
|
||||
@@ -161,14 +140,9 @@ export const getEvolucaoCadastros = query({
|
||||
(f) => f._creationTime >= date.getTime() && f._creationTime < nextDate.getTime()
|
||||
).length;
|
||||
|
||||
const solCount = solicitacoes.filter(
|
||||
(s) => s.dataSolicitacao >= date.getTime() && s.dataSolicitacao < nextDate.getTime()
|
||||
).length;
|
||||
|
||||
meses.push({
|
||||
mes: mesNome,
|
||||
funcionarios: funcCount,
|
||||
solicitacoes: solCount,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user