feat: Add baldinho calendar page for delivery date and parameter management, and configure Renovate.
This commit is contained in:
parent
7c613d5249
commit
1d392464e4
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: Renovate Bot
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
renovate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Self-hosted Renovate
|
||||||
|
uses: docker://renovate/renovate:latest
|
||||||
|
env:
|
||||||
|
RENOVATE_PLATFORM: 'gitea'
|
||||||
|
RENOVATE_ENDPOINT: 'http://git.jurunense.com/api/v1'
|
||||||
|
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||||
|
RENOVATE_AUTODISCOVER: 'true'
|
||||||
|
RENOVATE_REQUIRE_CONFIG: 'required'
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
module.exports = {
|
||||||
|
platform: 'gitea',
|
||||||
|
endpoint: 'https://git.jurunense.com/api/v1',
|
||||||
|
token: 'a605ffac82b25e40bc913c8b3f4344d07462fa47',
|
||||||
|
autodiscover: true,
|
||||||
|
onboarding: true,
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended"
|
||||||
|
],
|
||||||
|
"labels": [
|
||||||
|
"dependências"
|
||||||
|
],
|
||||||
|
"assignees": [
|
||||||
|
"renovate-bot"
|
||||||
|
],
|
||||||
|
"timezone": "America/Belem",
|
||||||
|
"schedule": [
|
||||||
|
"before 6am on Monday"
|
||||||
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchPackagePatterns": [
|
||||||
|
"^@radix-ui/"
|
||||||
|
],
|
||||||
|
"groupName": "Radix UI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": [
|
||||||
|
"next",
|
||||||
|
"eslint-config-next"
|
||||||
|
],
|
||||||
|
"groupName": "Next.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": [
|
||||||
|
"react",
|
||||||
|
"react-dom",
|
||||||
|
"@types/react",
|
||||||
|
"@types/react-dom"
|
||||||
|
],
|
||||||
|
"groupName": "React"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": [
|
||||||
|
"oracledb",
|
||||||
|
"@types/oracledb"
|
||||||
|
],
|
||||||
|
"groupName": "Oracle Database"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": [
|
||||||
|
"tailwindcss",
|
||||||
|
"tailwindcss-animate",
|
||||||
|
"tailwind-merge",
|
||||||
|
"postcss"
|
||||||
|
],
|
||||||
|
"groupName": "Tailwind CSS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": [
|
||||||
|
"typescript",
|
||||||
|
"@types/node"
|
||||||
|
],
|
||||||
|
"groupName": "TypeScript"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vulnerabilityAlerts": {
|
||||||
|
"labels": [
|
||||||
|
"segurança"
|
||||||
|
],
|
||||||
|
"assignees": [
|
||||||
|
"renovate-bot"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,10 +13,6 @@ async function updateBladinho(delivery: boolean, date: Date) {
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const formattedDate = `${day}/${month}/${year}`;
|
const formattedDate = `${day}/${month}/${year}`;
|
||||||
|
|
||||||
console.log(
|
|
||||||
`🔄 Tentando atualizar: data=${formattedDate}, delivery=${deliveryValue}`
|
|
||||||
);
|
|
||||||
|
|
||||||
// Usa objeto de binds para evitar problemas com palavras reservadas
|
// Usa objeto de binds para evitar problemas com palavras reservadas
|
||||||
// TO_DATE converte a string DD/MM/YYYY para DATE do Oracle
|
// TO_DATE converte a string DD/MM/YYYY para DATE do Oracle
|
||||||
const sql = `
|
const sql = `
|
||||||
|
|
@ -29,17 +25,7 @@ async function updateBladinho(delivery: boolean, date: Date) {
|
||||||
dataVal: formattedDate,
|
dataVal: formattedDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('📝 SQL:', sql);
|
|
||||||
console.log('📦 Binds:', JSON.stringify(binds, null, 2));
|
|
||||||
|
|
||||||
const rowsAffected = await executeOracleUpdate(sql, binds);
|
const rowsAffected = await executeOracleUpdate(sql, binds);
|
||||||
console.log(`✅ UPDATE concluído: ${rowsAffected} linha(s) atualizada(s)`);
|
|
||||||
|
|
||||||
if (rowsAffected === 0) {
|
|
||||||
console.warn(
|
|
||||||
'⚠️ Nenhuma linha foi atualizada. Verifique se a data existe na tabela.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rowsAffected;
|
return rowsAffected;
|
||||||
}
|
}
|
||||||
|
|
@ -51,8 +37,6 @@ async function updateBaldinhoDaysSale(daysSale: number): Promise<number> {
|
||||||
};
|
};
|
||||||
const result = await executeOracleUpdate(sql, binds);
|
const result = await executeOracleUpdate(sql, binds);
|
||||||
|
|
||||||
console.log(`✅ UPDATE concluído: ${result} linha(s) atualizada(s)`);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,15 +48,11 @@ async function updateBaldinhoDeliverySize(
|
||||||
deliverySize: deliverySize,
|
deliverySize: deliverySize,
|
||||||
};
|
};
|
||||||
const result = await executeOracleUpdate(sql, binds);
|
const result = await executeOracleUpdate(sql, binds);
|
||||||
console.log(`✅ UPDATE concluído: ${result} linha(s) atualizada(s)`);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeNoDelivery(date: Date, delivery: boolean) {
|
export async function changeNoDelivery(date: Date, delivery: boolean) {
|
||||||
await updateBladinho(delivery, date);
|
await updateBladinho(delivery, date);
|
||||||
console.log(
|
|
||||||
`clicado: ${date.toLocaleDateString('pt-BR')}, delivery: ${delivery}`
|
|
||||||
);
|
|
||||||
// Next 16 requires cache profile; empty config preserves current defaults
|
// Next 16 requires cache profile; empty config preserves current defaults
|
||||||
revalidateTag('baldinho', {});
|
revalidateTag('baldinho', {});
|
||||||
revalidatePath('/dias-rota');
|
revalidatePath('/dias-rota');
|
||||||
|
|
@ -80,14 +60,12 @@ export async function changeNoDelivery(date: Date, delivery: boolean) {
|
||||||
|
|
||||||
export async function changeBaldinhoDaysSale(daysSale: number) {
|
export async function changeBaldinhoDaysSale(daysSale: number) {
|
||||||
await updateBaldinhoDaysSale(daysSale);
|
await updateBaldinhoDaysSale(daysSale);
|
||||||
console.log(`clicado: ${daysSale}`);
|
revalidateTag('baldinho', {});
|
||||||
revalidateTag('baldinho');
|
|
||||||
revalidatePath('/dias-rota');
|
revalidatePath('/dias-rota');
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeBaldinhoDeliverySize(deliverySize: number) {
|
export async function changeBaldinhoDeliverySize(deliverySize: number) {
|
||||||
await updateBaldinhoDeliverySize(deliverySize);
|
await updateBaldinhoDeliverySize(deliverySize);
|
||||||
console.log(`clicado: ${deliverySize}`);
|
revalidateTag('baldinho', {});
|
||||||
revalidateTag('baldinho');
|
|
||||||
revalidatePath('/dias-rota');
|
revalidatePath('/dias-rota');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,13 +77,6 @@ const Pagina = ({ bladinhoData }: PaginaProps) => {
|
||||||
);
|
);
|
||||||
const [isLoadingDaysSale, setIsLoadingDaysSale] = useState(false);
|
const [isLoadingDaysSale, setIsLoadingDaysSale] = useState(false);
|
||||||
const [isLoadingDeliverySize, setIsLoadingDeliverySize] = useState(false);
|
const [isLoadingDeliverySize, setIsLoadingDeliverySize] = useState(false);
|
||||||
// Estado para controlar a abertura do AlertDialog
|
|
||||||
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
||||||
// Estado para armazenar a data e o novo valor de delivery quando o usuário clicar
|
|
||||||
const [pendingUpdate, setPendingUpdate] = useState<{
|
|
||||||
date: Date;
|
|
||||||
delivery: boolean;
|
|
||||||
} | null>(null);
|
|
||||||
|
|
||||||
const features = useMemo<Feature[]>(() => {
|
const features = useMemo<Feature[]>(() => {
|
||||||
return bladinhoData.map((item) => {
|
return bladinhoData.map((item) => {
|
||||||
|
|
@ -196,26 +189,6 @@ const Pagina = ({ bladinhoData }: PaginaProps) => {
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoadingDaysSale(false);
|
setIsLoadingDaysSale(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Armazena os dados e abre o dialog
|
|
||||||
setPendingUpdate({ date, delivery: newDelivery });
|
|
||||||
setIsDialogOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleConfirmUpdate = async () => {
|
|
||||||
if (pendingUpdate) {
|
|
||||||
// Executa o update apenas quando o usuário confirmar
|
|
||||||
await changeNoDelivery(pendingUpdate.date, pendingUpdate.delivery);
|
|
||||||
// Fecha o dialog e limpa o estado
|
|
||||||
setIsDialogOpen(false);
|
|
||||||
setPendingUpdate(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancelUpdate = () => {
|
|
||||||
// Apenas fecha o dialog e limpa o estado, sem fazer update
|
|
||||||
setIsDialogOpen(false);
|
|
||||||
setPendingUpdate(null);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBaldinhoDeliverySizeChange = async (deliverySize: number) => {
|
const handleBaldinhoDeliverySizeChange = async (deliverySize: number) => {
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,7 @@ export async function getOraclePool(): Promise<oracledb.Pool> {
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
try {
|
try {
|
||||||
pool = await oracledb.createPool(oracleConfig);
|
pool = await oracledb.createPool(oracleConfig);
|
||||||
console.log('✅ Pool Oracle criado com sucesso');
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Erro ao criar pool Oracle:', error);
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +49,6 @@ export async function executeOracleQuery(
|
||||||
});
|
});
|
||||||
return result.rows || [];
|
return result.rows || [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Erro ao executar query Oracle:', error);
|
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
if (connection) {
|
if (connection) {
|
||||||
|
|
@ -69,26 +66,12 @@ export async function executeOracleUpdate(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection = await pool.getConnection();
|
connection = await pool.getConnection();
|
||||||
console.log(
|
|
||||||
'🔍 Executando UPDATE com binds:',
|
|
||||||
JSON.stringify(binds, null, 2)
|
|
||||||
);
|
|
||||||
const result = await connection.execute(sql, binds, {
|
const result = await connection.execute(sql, binds, {
|
||||||
autoCommit: true, // Commit automático para UPDATE
|
autoCommit: true, // Commit automático para UPDATE
|
||||||
});
|
});
|
||||||
const rowsAffected = result.rowsAffected || 0;
|
const rowsAffected = result.rowsAffected || 0;
|
||||||
console.log(`✅ UPDATE executado: ${rowsAffected} linha(s) afetada(s)`);
|
|
||||||
if (rowsAffected === 0) {
|
|
||||||
console.warn(
|
|
||||||
'⚠️ ATENÇÃO: Nenhuma linha foi afetada pelo UPDATE. Verifique:'
|
|
||||||
);
|
|
||||||
console.warn(' - Se a data existe na tabela PCDIASUTEIS');
|
|
||||||
console.warn(' - Se CODFILIAL = 12 corresponde ao registro');
|
|
||||||
console.warn(' - Se o formato da data está correto');
|
|
||||||
}
|
|
||||||
return rowsAffected;
|
return rowsAffected;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Erro ao executar UPDATE Oracle:', error);
|
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
if (connection) {
|
if (connection) {
|
||||||
|
|
@ -101,7 +84,6 @@ export async function closeOraclePool(): Promise<void> {
|
||||||
if (pool) {
|
if (pool) {
|
||||||
await pool.close();
|
await pool.close();
|
||||||
pool = null;
|
pool = null;
|
||||||
console.log('✅ Pool Oracle fechado');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "react-jsx",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue