feat(api): enhance IP list management with new entry operations and improved error handling
Build and Push EvoFirewall Docker Image / build-and-push (push) Successful in 1m50s
Build and Push EvoFirewall Docker Image / create-release (push) Skipped

- Added endpoints for adding and deleting entries in IP lists.
- Refactored list creation logic to handle manual list types more effectively.
- Updated refresh logic to rebuild manual list entries.
- Improved error handling for entry operations to ensure data integrity.
- Enhanced response structure for list detail retrieval.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-07-20 23:01:23 +07:00
co-authored by Cursor
parent 7f0c1009de
commit 3f7672ab7c
11 changed files with 805 additions and 205 deletions
+16
View File
@@ -69,6 +69,21 @@ export function bumpAllApprovedAgents(db: Db) {
for (const r of rows) bumpAgentGeneration(db, r.id)
}
/** Bump agents that have a policy rule referencing this IP list. */
export function bumpAgentsForList(db: Db, listId: string) {
const rules = db
.select({ setId: policyRules.setId })
.from(policyRules)
.where(eq(policyRules.listId, listId))
.all()
const setIds = [...new Set(rules.map((r) => r.setId))]
if (setIds.length === 0) {
bumpAllApprovedAgents(db)
return
}
for (const setId of setIds) bumpAgentsForSet(db, setId)
}
export function listIpLists(db: Db) {
return db.select().from(ipLists).orderBy(desc(ipLists.createdAt)).all()
}
@@ -429,6 +444,7 @@ export const repos = {
bumpAgentGeneration,
bumpAgentsForSet,
bumpAllApprovedAgents,
bumpAgentsForList,
listIpLists,
getIpList,
insertIpList,