foxhole/app/hysql.hy

25 lines
727 B
Hy
Raw Normal View History

2024-03-11 15:35:32 +01:00
#!/usr/bin/env hy
(import app [models])
(import app.database [async_session])
(import sqlalchemy [select])
(import app.activitypub [VisibilityEnum])
2024-03-11 15:35:32 +01:00
(import pprint [pprint])
2024-09-29 18:42:10 +02:00
(defn :async selete_object
2024-03-11 15:35:32 +01:00
[db ap_type]
(.all (await (.scalars db
(.where (select models.InboxObject)
(= models.InboxObject.ap_type ap_type))))))
2024-09-29 18:42:10 +02:00
(defn :async get_index_status
[db]
(.all (await
(.scalars db
2024-03-17 10:10:58 +01:00
(.order_by
(.where (select models.OutboxObject)
(.in_ models.OutboxObject.visibility [VisibilityEnum.PUBLIC VisibilityEnum.UNLISTED])
(.is_ models.OutboxObject.is_deleted False))
(.desc models.OutboxObject.created_at))))))