Commit Graph

48 Commits

Author SHA1 Message Date
Kenneth Kehl
3b651a2716 fix first paginate method 2024-10-18 09:05:03 -07:00
Kenneth Kehl
78aab59d15 fix first paginate method 2024-10-18 08:45:31 -07:00
Kenneth Kehl
fdc494e561 fix delete 2024-10-18 08:12:22 -07:00
Kenneth Kehl
ea32db8df3 revert pagination fix 2024-10-17 14:28:22 -07:00
Kenneth Kehl
be56461587 fix delete_inbound_sms_older_than_retention and dao_get_inbound_sms_by_id 2024-10-17 14:17:00 -07:00
Kenneth Kehl
6f29a0e5a4 fix delete_inbound_sms_older_than_retention and dao_get_inbound_sms_by_id 2024-10-17 14:05:03 -07:00
Kenneth Kehl
3c3fb8eb3a fix delete_inbound_sms_older_than_retention and dao_get_inbound_sms_by_id 2024-10-17 13:52:25 -07:00
Kenneth Kehl
cfce20fb46 fix delete_inbound_sms_older_than_retention and dao_get_inbound_sms_by_id 2024-10-17 13:39:05 -07:00
Kenneth Kehl
80d05532e7 fix delete_inbound_sms_older_than_retention and dao_get_inbound_sms_by_id 2024-10-17 13:22:41 -07:00
Kenneth Kehl
dd4bf2abd3 fix delete_inbound_sms_older_than_retention and dao_get_inbound_sms_by_id 2024-10-17 13:10:02 -07:00
Kenneth Kehl
af22cbcab9 start InboundSmsDao 2024-10-17 12:58:35 -07:00
Kenneth Kehl
0f1d70f593 start InboundSmsDao 2024-10-17 12:44:28 -07:00
Kenneth Kehl
672fb364ec start InboundSmsDao 2024-10-17 12:36:26 -07:00
Kenneth Kehl
608f1ec3a3 start InboundSmsDao 2024-10-17 12:27:17 -07:00
Kenneth Kehl
c818bac288 start InboundSmsDao 2024-10-17 12:24:23 -07:00
Aditi Anand
ad55eef5e9 Changes for sqlalchemy 2.0 2024-04-24 16:27:20 -04:00
Cliff Hill
3982f061b6 Made enums.py for all the enums to avoid cyclic imports.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:43:31 -05:00
Cliff Hill
43f18eed6a More changes for enums.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:41:57 -05:00
Cliff Hill
820ee5a942 Cleaning up a lot of things, getting Enums used everywhere.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2024-02-28 12:40:52 -05:00
Kenneth Kehl
1ecb747c6d reformat 2023-08-29 14:54:30 -07:00
Rebecca Law
68d28aa83b The update of SQLAlchemy 1.4.10 has caused some conflicts in our code. This PR fixes most of those conflicts.
- sqlalchemy.sql.expression.case must include an else statement.
- clearly define list of columns for inbound_sms_history insert, getting the list from InboundSmsHistory.__table__.c was causing data type errors.
- remove relationships when not needed, the foreign key relationship is established in the creation of the column. This will get rid of the warnings referenced here: http://sqlalche.me/e/14/qzyx.
- update queries now that he user relationship in ServiceUser db model has been removed.
- move the check that a template is archived to the view instead of the dao method. The check was clearing the session before the version history could be done.

Deleting notifications in the night tasks still needs to be
investigated. The raw sql is causing an error.
2021-04-29 13:32:36 +01:00
Rebecca Law
85895a9e8b Revert "Scheduled weekly dependency update for week 16" 2021-04-28 10:17:16 +01:00
Rebecca Law
1b070d69a1 The update of SQLAlchemy 1.4.10 has caused some conflicts in our code. This PR fixes most of those conflicts.
- sqlalchemy.sql.expression.case must include an else statement.
- clearly define list of columns for inbound_sms_history insert, getting the list from InboundSmsHistory.__table__.c was causing data type errors.
- remove relationships when not needed, the foreign key relationship is established in the creation of the column. This will get rid of the warnings referenced here: http://sqlalche.me/e/14/qzyx.
- update queries now that he user relationship in ServiceUser db model has been removed.
- move the check that a template is archived to the view instead of the dao method. The check was clearing the session before the version history could be done.

Deleting notifications in the night tasks still needs to be
investigated. The raw sql is causing an error.
2021-04-26 11:50:30 +01:00
Rebecca Law
d4009ffc52 Rename database management functions.
Rename @transactional to @autocommit.
Rename nested_transaction to tranaction.
2021-04-19 10:56:00 +01:00
Ben Thorner
a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
Pea Tyczynska
9c4205c7c6 Remove statsd decorators from dao functions
This done so that we do not use statsd on our http endpoint.
We decided we do not need metrics that this gave us. If we
change our minds, we will add Prometheus-friendly decorators
instead in the future.
2020-07-07 18:02:24 +01:00
David McDonald
f948555ca8 Do nothing on db conflict
For notification and notification_history we do an upsert. Here, as the
inbound_sms table is never updated, only inserted to once (signified by
lack of updated_at field), an upsert would be unnecessary.

Therefore, if for some reason the delete statement failed as part of
moving data into the inbound_sms_history table, we can simply just
ignore any db conflicts raised by a rerun of
`delete_inbound_sms_older_than_retention`.
2019-12-24 09:39:06 +00:00
Pea Tyczynska
f8ff2d121f Changes following review:
- Check if right keys in new history rows
- Improve model and get rid of old revision version
- Add updated migration file
- Test data when inserting into inbound sms history
2019-12-20 16:17:27 +00:00
Pea Tyczynska
448cd1e94e Integrate inbound history insert into delete inbound sms function 2019-12-20 16:16:29 +00:00
Pea Tyczynska
a6b4675ae7 Populate inbound sms history when deleting inbound sms 2019-12-20 16:16:29 +00:00
Leo Hemsted
cf248a2af3 combine post + get inbound, and make them respect data retention
also removed the limit/limit_days args as they're not used by admin
2019-03-28 15:38:26 +00:00
Leo Hemsted
97110e293b make inbound sms page respect data retention
also, it should default to last 7 days, not last 6 days. also change
count_inbound_sms to have the days passed in, so that it's more
explicit at the endpoint that we only return 7 days regardless of your
service's data retention
2019-03-27 17:47:26 +00:00
Leo Hemsted
7683e340cc get all inbound sms should default to 7 days, not 6
to be consistent with other checks.
2019-02-28 15:28:13 +00:00
Leo Hemsted
b4d1a590b7 rename days_ago_to_start to limit_days
consistency with the rest of the app
2019-02-28 13:59:59 +00:00
Leo Hemsted
88303140ec give dao_get_inbound_sms_for_service optional day limit
defaults to 6 to preserve backwards compatibility
2019-02-27 17:17:35 +00:00
Leo Hemsted
e7b8f83fc8 make inbound sms honour data retention
code inspired by the delete notification code, but with some clean up
since we don't deal with different types etc, and only need to run the
query for services with inbound numbers

also, update tests.app.db.create_inbound_sms to create inbound numbers
and assign them to services to ensure the test db is always accurate
and reflects real world usage
2019-02-27 15:53:55 +00:00
chrisw
2abbb590ab Only get inbound messages that are a maximum of 7 days old 2018-05-10 14:00:55 +01:00
chrisw
0f2ddd8cfa added new paginated inbound endpoint 2018-04-04 17:10:41 +01:00
chrisw
ac50250ad7 update paginated inbound sms method 2018-03-23 11:09:51 +00:00
Richard Chapman
d855b4e4ec Removed statsd from the api and use the statsd in the utils library.
The statsd code was added to the utils library a while ago, uses the
statsd from the util library and therefore consolidates the code into
once place.
2018-02-06 09:52:15 +00:00
Ken Tsang
36fb2fb28c Remove user_number from inbound sms dao 2017-11-09 15:23:16 +00:00
Ken Tsang
2e66fe5e38 Removed page from get paginated args as not used 2017-11-07 13:29:40 +00:00
Ken Tsang
02ee072251 Refactor inbound sms dao
Added function for paginated results
2017-11-07 13:29:40 +00:00
Imdad Ahad
5b4ceda1c6 Refactor:
* Filter inbound by service_id
* Refactor to return 404 instead of 400 for consistency
2017-06-07 14:23:31 +01:00
Imdad Ahad
23a501af16 Add dao to get inbound sms by id 2017-06-06 17:11:59 +01:00
Imdad Ahad
0631b6c988 Add dao to delete inbound sms after seven days 2017-06-02 16:10:27 +01:00
Leo Hemsted
ef52337d85 add inbound sms api
two endpoints:
* get all inbound sms for a service (you can limit to the X most
  recent, or filter by user's phone number [which will be normalised])
* get a summary of inbound sms for a service - returns the count of
  inbound sms in the database, and the date that the most recent was
  sent
2017-06-02 15:20:18 +01:00
Leo Hemsted
4a85818c34 add inbound sms table 2017-05-30 10:47:01 +01:00