-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3396e77
commit b298f13
Showing
5 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- app/api/database/postgres/queries/domain/edit_add.sql | ||
-- Add new domains | ||
INSERT INTO targets.domains ("domain", active, is_objective) | ||
VALUES (LOWER(:domain), TRUE, TRUE) | ||
RETURNING "domain", id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- app/api/database/postgres/queries/domain/edit_update.sql | ||
-- Updates existing domains | ||
UPDATE targets.domains | ||
SET active = :active, | ||
is_objective = :is_objective | ||
WHERE "domain" = :domain | ||
RETURNING "domain", id, active, is_objective; |
14 changes: 14 additions & 0 deletions
14
app/api/database/postgres/queries/domain/list_edit_domains.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- app/api/database/postgres/queries/domain/list_edit_domains.sql | ||
-- Select domains from search before editing | ||
SELECT d."domain", | ||
COUNT(u.url) AS url_count, | ||
d.active, | ||
d.is_objective, | ||
d.is_valid, | ||
date_trunc('day', age(now(), d.created_at)) AS created_ago, | ||
date_trunc('day', age(now(), d.updated_at)) AS updated_ago | ||
FROM targets.domains d | ||
LEFT JOIN targets.urls u ON d.id = u.domain_id | ||
WHERE d."domain" ILIKE '%s' | ||
AND is_valid = TRUE | ||
GROUP BY d."domain", d.active, d.is_objective, d.is_valid, d.created_at, d.updated_at; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- app/api/database/postgres/queries/domain/update.sql | ||
-- Update Domain objective status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters