Commit graph

20 commits

Author SHA1 Message Date
ce29074530 backup: include cross-checker discovery entries in backup/restore
Extend Backup to carry the two new KV indexes introduced by the
discovery mechanism.
2026-04-28 13:06:23 +07:00
fa7700355a backup: include core checker entities in backup/restore
All checks were successful
continuous-integration/drone/push Build is passing
Extend the admin backup to cover checker configurations, plans,
evaluations and executions — previously these were stored but silently
lost on restore. Add RestoreX storage methods so primary records keep
their original Id and secondary indexes are rebuilt (Create* generates
new IDs, Update* requires an existing record to clean stale indexes).
2026-04-22 12:45:45 +07:00
da1eb33faf tidy: add drop_invalid flag to delete undecodable records
Thread a dropInvalid bool through every TidyUpUseCase method and
expose it as a drop_invalid query parameter on POST /tidy (default
true). When set, Tidy deletes records that fail to decode — e.g.
legacy executions and evaluations whose CheckState.Status was stored
as a string before the SDK switched it to int — instead of leaving
them stuck in the store to log on every iteration.

Also reset KVIterator.err on exhaustion so a prior decode failure
does not surface as a spurious iteration error.
2026-04-22 12:45:45 +07:00
e0dc19614f checker: enforce MaxChecksPerDay quota with interval-aware throttling
Some checks failed
continuous-integration/drone/push Build is failing
Wire UserQuota.MaxChecksPerDay field into the scheduler via the
UserGater: an in-memory daily counter per user
(reset at UTC midnight): gates scheduled executions, with a two-tier
heuristic that skips short-interval jobs first once the budget is 80%
consumed so rare/important checks are not starved by frequent
pings. Planned executions returned by ListPlannedExecutions are marked
with a new ExecutionRateLimited status when the user is over
budget. Manual API triggers bypass the quota.
2026-04-16 15:18:43 +07:00
8876b3972a model: add UserQuota struct for admin-controlled per-user limits
Introduce a UserQuota field on the User model to hold admin-controlled
limits and flags that the user cannot modify. Only checker-related
fields are defined for now (max checks per day, retention days,
inactivity pause days, scheduling kill switch); future paid-plan
attributes will be added here later.

The user-facing API only exposes settings updates and account deletion,
so Quota cannot be written through it. Updates go through the existing
admin user PUT endpoint, with a new editor card in the admin UI under
/users/[uid].
2026-04-16 15:18:43 +07:00
439fe2a2e9 checkers: show worst check status badge on domain list
Add DomainWithCheckStatus model and GetWorstDomainStatuses usecase to
compute the most critical checker status per domain. The GET /domains
endpoint now returns status alongside each domain. The frontend domain
store, list components, and table row display dynamic status badges
with color and icon instead of a hardcoded "OK".

ZoneList is made generic (T extends HappydnsDomain) so the badges
snippet preserves the caller's concrete type without unsafe casts.
2026-04-16 15:18:43 +07:00
ee8e7b322d checkers: add API controllers, routes, and app wiring
Wire up the checker system to the HTTP layer:
- API controllers for checker operations, options, plans, and results
- Scoped routes at domain and service level
- Admin controllers for checker config and scheduler management
- App initialization: create usecases, start/stop scheduler
- Zone controller updated to include per-service check status
2026-04-16 15:18:43 +07:00
e9db206e78 Add context.Context to ProviderUsecase and DomainUsecase interfaces
All checks were successful
continuous-integration/drone/push Build is passing
Propagate context.Context as first parameter through all provider and
domain usecase interface methods that didn't already have it. This is
a prerequisite for the upcoming secret management layer, which needs
request-scoped context to carry session-derived encryption keys.
2026-03-30 21:54:54 +07:00
36a7d8e9d3 Fix email validation HMAC weakness and prevent user enumeration on registration 2026-03-16 19:44:14 +07:00
1be73506cb Reformat long function signatures 2026-03-14 12:02:00 +07:00
001b919870 fix: resolve go vet variable shadowing warnings 2026-03-01 17:37:59 +07:00
c9552fa9b2 Remove UsecaseDependancies service locator pattern
All checks were successful
continuous-integration/drone/push Build is passing
Replace the UsecaseDependancies interface with plain Dependencies structs
defined locally in each route package. DeclareRoutes acts as the sole
composition root where use cases are resolved; sub-route functions and
controllers receive only the specific interfaces they need.
2026-02-14 10:49:46 +07:00
ad2e17bc5a api-admin: Fix PUT request to update provider 2026-01-26 12:34:55 +08:00
cd0aff2fcc api-admin: Document routes 2026-01-26 12:34:55 +08:00
b2b6467575 Refactor domain/provider/zone usecase: split in multiple files 2025-05-28 23:02:22 +02:00
1408e04f45 Refactor domain's logs usecase: split in multiple files 2025-05-28 23:02:22 +02:00
0495ab4693 Refactor auth_user usecase: split in multiple files 2025-05-28 23:02:22 +02:00
356e733e76 Move config struct to model, avoid dependancy to storage 2025-05-28 22:00:02 +02:00
e186a33f89 refactor: Move storage interfaces to usecases 2025-05-28 22:00:02 +02:00
5ef9419072 refactor: restructure project architecture and folder hierarchy
- Moved usecases into internal/usecase
- Renamed internal/utils to internal/helpers for better naming semantics
- Clarified separation between domain model, usecases, adapters, and web/API
2025-05-28 22:00:02 +02:00