mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 02:51:46 +00:00
chore(tooling): add mockup helper and backup fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.4.7/schema.json",
|
||||
"$schema": "https://biomejs.dev/schemas/2.4.8/schema.json",
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
|
||||
1
drizzle/0010_lame_psynapse.sql
Normal file
1
drizzle/0010_lame_psynapse.sql
Normal file
@@ -0,0 +1 @@
|
||||
-- placeholder: migration aplicada via db:push, arquivo original não preservado
|
||||
@@ -5,6 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"dev-env": "tsx scripts/dev.ts",
|
||||
"mockup": "tsx scripts/mock-data.ts",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "biome check .",
|
||||
|
||||
@@ -81,7 +81,7 @@ fi
|
||||
|
||||
# Extrai dados puros do dump custom (sem nova conexão ao banco)
|
||||
pg_restore --data-only --schema=public --no-owner --no-privileges \
|
||||
"$DUMP_FILE" | gzip > "$DATA_FILE"
|
||||
-f - "$DUMP_FILE" | gzip > "$DATA_FILE"
|
||||
|
||||
log "Dump concluído: $(du -sh "$DUMP_FILE" | cut -f1) (.dump) | $(du -sh "$SQL_FILE" | cut -f1) (.sql.gz) | $(du -sh "$DATA_FILE" | cut -f1) (.data.sql.gz)"
|
||||
|
||||
|
||||
@@ -135,11 +135,11 @@ type SeedSummary = {
|
||||
function printUsage() {
|
||||
console.log(`
|
||||
Uso:
|
||||
pnpm seed:empty-account -- --userId=<id> --startPeriod=YYYY-MM [--months=${DEFAULT_MONTHS}]
|
||||
pnpm mockup -- --userId=<id> --startPeriod=YYYY-MM [--months=${DEFAULT_MONTHS}]
|
||||
|
||||
Exemplos:
|
||||
pnpm seed:empty-account -- --userId=user_123 --startPeriod=2026-01
|
||||
pnpm seed:empty-account -- --userId=user_123 --startPeriod=2025-10 --months=8
|
||||
pnpm mockup -- --userId=user_123 --startPeriod=2026-01
|
||||
pnpm mockup -- --userId=user_123 --startPeriod=2025-10 --months=8
|
||||
`);
|
||||
}
|
||||
|
||||
@@ -766,11 +766,12 @@ async function seedInvoicesForCards(params: {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const options = parseArgs(process.argv.slice(2));
|
||||
|
||||
if (!process.env.DATABASE_URL) {
|
||||
throw new Error("DATABASE_URL não está configurada no ambiente.");
|
||||
}
|
||||
|
||||
const options = parseArgs(process.argv.slice(2));
|
||||
const logoOptions = await loadLogoOptions();
|
||||
const avatarOptions = await loadAvatarOptions();
|
||||
const businessToday = getBusinessTodayInfo();
|
||||
@@ -794,9 +795,8 @@ async function main() {
|
||||
throw new Error(`Usuário ${options.userId} não foi encontrado.`);
|
||||
}
|
||||
|
||||
await ensureCategories(targetUser.id);
|
||||
const adminPayer = await ensureAdminPayer(targetUser);
|
||||
await assertFinancialSpaceIsEmpty(targetUser.id);
|
||||
const adminPayer = await ensureAdminPayer(targetUser);
|
||||
|
||||
const categoriesByName = await ensureCategories(targetUser.id);
|
||||
|
||||
|
||||
@@ -75,7 +75,9 @@ function getItemDateKey(date: Date): string {
|
||||
// Para "hoje" e "ontem", precisamos da data real de Brasília (UTC-3).
|
||||
function getBrasiliaDateKey(date: Date): string {
|
||||
const BRASILIA_OFFSET_MS = 3 * 60 * 60 * 1000;
|
||||
return new Date(date.getTime() - BRASILIA_OFFSET_MS).toISOString().slice(0, 10);
|
||||
return new Date(date.getTime() - BRASILIA_OFFSET_MS)
|
||||
.toISOString()
|
||||
.slice(0, 10);
|
||||
}
|
||||
|
||||
function getGroupLabel(dateKey: string): string {
|
||||
|
||||
Reference in New Issue
Block a user