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": {
|
"vcs": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"clientKind": "git",
|
"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": {
|
"scripts": {
|
||||||
"dev": "next dev --turbopack",
|
"dev": "next dev --turbopack",
|
||||||
"dev-env": "tsx scripts/dev.ts",
|
"dev-env": "tsx scripts/dev.ts",
|
||||||
|
"mockup": "tsx scripts/mock-data.ts",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "biome check .",
|
"lint": "biome check .",
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ fi
|
|||||||
|
|
||||||
# Extrai dados puros do dump custom (sem nova conexão ao banco)
|
# Extrai dados puros do dump custom (sem nova conexão ao banco)
|
||||||
pg_restore --data-only --schema=public --no-owner --no-privileges \
|
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)"
|
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() {
|
function printUsage() {
|
||||||
console.log(`
|
console.log(`
|
||||||
Uso:
|
Uso:
|
||||||
pnpm seed:empty-account -- --userId=<id> --startPeriod=YYYY-MM [--months=${DEFAULT_MONTHS}]
|
pnpm mockup -- --userId=<id> --startPeriod=YYYY-MM [--months=${DEFAULT_MONTHS}]
|
||||||
|
|
||||||
Exemplos:
|
Exemplos:
|
||||||
pnpm seed:empty-account -- --userId=user_123 --startPeriod=2026-01
|
pnpm mockup -- --userId=user_123 --startPeriod=2026-01
|
||||||
pnpm seed:empty-account -- --userId=user_123 --startPeriod=2025-10 --months=8
|
pnpm mockup -- --userId=user_123 --startPeriod=2025-10 --months=8
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -766,11 +766,12 @@ async function seedInvoicesForCards(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
const options = parseArgs(process.argv.slice(2));
|
||||||
|
|
||||||
if (!process.env.DATABASE_URL) {
|
if (!process.env.DATABASE_URL) {
|
||||||
throw new Error("DATABASE_URL não está configurada no ambiente.");
|
throw new Error("DATABASE_URL não está configurada no ambiente.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = parseArgs(process.argv.slice(2));
|
|
||||||
const logoOptions = await loadLogoOptions();
|
const logoOptions = await loadLogoOptions();
|
||||||
const avatarOptions = await loadAvatarOptions();
|
const avatarOptions = await loadAvatarOptions();
|
||||||
const businessToday = getBusinessTodayInfo();
|
const businessToday = getBusinessTodayInfo();
|
||||||
@@ -794,9 +795,8 @@ async function main() {
|
|||||||
throw new Error(`Usuário ${options.userId} não foi encontrado.`);
|
throw new Error(`Usuário ${options.userId} não foi encontrado.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await ensureCategories(targetUser.id);
|
|
||||||
const adminPayer = await ensureAdminPayer(targetUser);
|
|
||||||
await assertFinancialSpaceIsEmpty(targetUser.id);
|
await assertFinancialSpaceIsEmpty(targetUser.id);
|
||||||
|
const adminPayer = await ensureAdminPayer(targetUser);
|
||||||
|
|
||||||
const categoriesByName = await ensureCategories(targetUser.id);
|
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).
|
// Para "hoje" e "ontem", precisamos da data real de Brasília (UTC-3).
|
||||||
function getBrasiliaDateKey(date: Date): string {
|
function getBrasiliaDateKey(date: Date): string {
|
||||||
const BRASILIA_OFFSET_MS = 3 * 60 * 60 * 1000;
|
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 {
|
function getGroupLabel(dateKey: string): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user