rococo 1.2.0__tar.gz → 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rococo-1.2.0 → rococo-1.2.1}/PKG-INFO +1 -1
- {rococo-1.2.0 → rococo-1.2.1}/rococo/data/postgresql.py +4 -2
- {rococo-1.2.0 → rococo-1.2.1}/rococo/data/surrealdb.py +4 -2
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/postgresql/postgresql_repository.py +9 -4
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/surrealdb/surreal_db_repository.py +4 -2
- {rococo-1.2.0 → rococo-1.2.1}/rococo.egg-info/PKG-INFO +1 -1
- {rococo-1.2.0 → rococo-1.2.1}/setup.py +1 -1
- {rococo-1.2.0 → rococo-1.2.1}/tests/postgre_repository_test.py +6 -3
- {rococo-1.2.0 → rococo-1.2.1}/LICENSE +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/README.md +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/auth/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/auth/tokens.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/config/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/config/config.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/data/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/data/base.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/data/dynamodb.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/data/mongodb.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/data/mysql.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/emailing/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/emailing/base.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/emailing/config.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/emailing/enums.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/emailing/factory.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/emailing/mailjet.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/emailing/ses.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/faxing/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/faxing/base.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/faxing/config.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/faxing/enums.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/faxing/factory.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/faxing/ifax.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/messaging/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/messaging/base.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/messaging/rabbitmq.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/messaging/sqs.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/common/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/common/cli_base.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/common/migration_base.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/common/migration_runner.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/common/migration_template.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/mongo/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/mongo/cli.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/mongo/migration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/mysql/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/mysql/cli.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/mysql/migration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/postgres/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/postgres/cli.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/migrations/postgres/migration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/email.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/login_method.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/organization.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/otp_method.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/person.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/person_organization_role.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/recovery_code.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/email.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/login_method.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/organization.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/otp_method.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/person.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/person_organization_role.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/surrealdb/surreal_versioned_model.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/models/versioned_model.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/plugins/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/plugins/pooled_connection.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/base_repository.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/dynamodb/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/dynamodb/dynamodb_repository.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/mongodb/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/mongodb/mongodb_repository.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/mysql/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/mysql/mysql_repository.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/mysql/organization_repository.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/postgresql/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/surrealdb/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/surrealdb/organization_repository.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/surrealdb/person_organization_role_repository.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/sms/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/sms/base.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/sms/config.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/sms/enums.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/sms/factory.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo/sms/twilio.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo.egg-info/SOURCES.txt +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo.egg-info/dependency_links.txt +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo.egg-info/entry_points.txt +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo.egg-info/requires.txt +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/rococo.egg-info/top_level.txt +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/setup.cfg +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/base_repository_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/config_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/__init__.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/conftest.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/test_dynamodb_integration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/test_models.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/test_mongodb_integration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/test_mysql_integration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/test_postgres_integration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/database-integration/test_surrealdb_integration.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/dynamodb_repository_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/migration_runner_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/model_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/mongodb_repository_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/mysql_repository_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/surrealdb_repository_test.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/test_calculated_properties_fix.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/test_faxing.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/test_mailjet_addresses.py +0 -0
- {rococo-1.2.0 → rococo-1.2.1}/tests/test_non_versioned_model.py +0 -0
|
@@ -160,7 +160,8 @@ class PostgreSQLAdapter(DbAdapter):
|
|
|
160
160
|
conditions: Dict[str, Any],
|
|
161
161
|
sort: List[Tuple[str, str]] = None,
|
|
162
162
|
join_statements: list = None,
|
|
163
|
-
additional_fields: list = None
|
|
163
|
+
additional_fields: list = None,
|
|
164
|
+
active: bool = True
|
|
164
165
|
) -> Optional[Dict[str, Any]]:
|
|
165
166
|
fields = [f'{table}.*']
|
|
166
167
|
if additional_fields:
|
|
@@ -175,7 +176,8 @@ class PostgreSQLAdapter(DbAdapter):
|
|
|
175
176
|
if conditions:
|
|
176
177
|
condition_strs_values = [self._build_condition_string(
|
|
177
178
|
table, k, v) for k, v in conditions.items()]
|
|
178
|
-
|
|
179
|
+
if active:
|
|
180
|
+
condition_strs_values.append((f"{table}.active = %s", ['true']))
|
|
179
181
|
query += f" WHERE {' AND '.join([condition_str for condition_str, condition_value in condition_strs_values])}"
|
|
180
182
|
|
|
181
183
|
if sort:
|
|
@@ -108,7 +108,8 @@ class SurrealDbAdapter(DbAdapter):
|
|
|
108
108
|
conditions: Dict[str, Any],
|
|
109
109
|
sort: List[Tuple[str, str]] = None,
|
|
110
110
|
fetch_related: list = None,
|
|
111
|
-
additional_fields: list = None
|
|
111
|
+
additional_fields: list = None,
|
|
112
|
+
active: bool = True
|
|
112
113
|
) -> Dict[str, Any]:
|
|
113
114
|
fields = ['*']
|
|
114
115
|
if additional_fields:
|
|
@@ -120,7 +121,8 @@ class SurrealDbAdapter(DbAdapter):
|
|
|
120
121
|
if conditions:
|
|
121
122
|
condition_strs = [
|
|
122
123
|
f"{self._build_condition_string(k, v)}" for k, v in conditions.items()]
|
|
123
|
-
|
|
124
|
+
if active:
|
|
125
|
+
condition_strs.append("active=true")
|
|
124
126
|
query += f" WHERE {' AND '.join(condition_strs)}"
|
|
125
127
|
|
|
126
128
|
if sort:
|
|
@@ -79,7 +79,8 @@ class PostgreSQLRepository(BaseRepository):
|
|
|
79
79
|
conditions = self._adjust_conditions(conditions)
|
|
80
80
|
|
|
81
81
|
data = self._execute_within_context(
|
|
82
|
-
self.adapter.get_one, self.table_name, conditions
|
|
82
|
+
self.adapter.get_one, self.table_name, conditions,
|
|
83
|
+
active=self._is_versioned_model()
|
|
83
84
|
)
|
|
84
85
|
|
|
85
86
|
if not data:
|
|
@@ -118,7 +119,8 @@ class PostgreSQLRepository(BaseRepository):
|
|
|
118
119
|
conditions = self._adjust_conditions(conditions)
|
|
119
120
|
# Fetch the records
|
|
120
121
|
records = self._execute_within_context(
|
|
121
|
-
self.adapter.get_many, self.table_name, conditions, sort, limit, offset
|
|
122
|
+
self.adapter.get_many, self.table_name, conditions, sort, limit, offset,
|
|
123
|
+
active=self._is_versioned_model()
|
|
122
124
|
)
|
|
123
125
|
|
|
124
126
|
# If the adapter returned a single dictionary, wrap it in a list
|
|
@@ -164,8 +166,11 @@ class PostgreSQLRepository(BaseRepository):
|
|
|
164
166
|
int: The count of matching records.
|
|
165
167
|
"""
|
|
166
168
|
# Prepare the actual conditions for the database query
|
|
167
|
-
#
|
|
168
|
-
|
|
169
|
+
# Only add versioning filters for VersionedModel
|
|
170
|
+
if self._is_versioned_model():
|
|
171
|
+
db_conditions = {'latest': True, 'active': True}
|
|
172
|
+
else:
|
|
173
|
+
db_conditions = {}
|
|
169
174
|
if query: # Ensure query is not None before updating
|
|
170
175
|
actual_query = self._adjust_conditions(
|
|
171
176
|
query.copy()) # Adjust UUIDs in query
|
|
@@ -197,7 +197,8 @@ class SurrealDbRepository(BaseRepository):
|
|
|
197
197
|
self.table_name,
|
|
198
198
|
conditions,
|
|
199
199
|
fetch_related=fetch_related,
|
|
200
|
-
additional_fields=additional_fields
|
|
200
|
+
additional_fields=additional_fields,
|
|
201
|
+
active=self._is_versioned_model()
|
|
201
202
|
)
|
|
202
203
|
# prep model context
|
|
203
204
|
self.model()
|
|
@@ -265,7 +266,8 @@ class SurrealDbRepository(BaseRepository):
|
|
|
265
266
|
sort=sort,
|
|
266
267
|
limit=limit,
|
|
267
268
|
fetch_related=fetch_related,
|
|
268
|
-
additional_fields=additional_fields
|
|
269
|
+
additional_fields=additional_fields,
|
|
270
|
+
active=self._is_versioned_model()
|
|
269
271
|
)
|
|
270
272
|
if isinstance(raw, dict):
|
|
271
273
|
raw = [raw]
|
|
@@ -238,7 +238,8 @@ def test_get_one_existing_record(repository, mock_adapter, model_instance):
|
|
|
238
238
|
# In this case, 'entity_id' value is a single UUID, adjust_conditions doesn't modify it.
|
|
239
239
|
mock_adapter.get_one.assert_called_once_with(
|
|
240
240
|
repository.table_name,
|
|
241
|
-
query_conditions # adjust_conditions doesn't change single UUID values
|
|
241
|
+
query_conditions, # adjust_conditions doesn't change single UUID values
|
|
242
|
+
active=True # VersionedModel passes active=True
|
|
242
243
|
)
|
|
243
244
|
mock_adapter.__enter__.assert_called_once()
|
|
244
245
|
mock_adapter.__exit__.assert_called_once()
|
|
@@ -256,7 +257,8 @@ def test_get_one_with_uuid_list_in_conditions(repository, mock_adapter, model_in
|
|
|
256
257
|
|
|
257
258
|
mock_adapter.get_one.assert_called_once_with(
|
|
258
259
|
repository.table_name,
|
|
259
|
-
expected_conditions_for_adapter
|
|
260
|
+
expected_conditions_for_adapter,
|
|
261
|
+
active=True # VersionedModel passes active=True
|
|
260
262
|
)
|
|
261
263
|
|
|
262
264
|
|
|
@@ -293,7 +295,8 @@ def test_get_many_records(repository, mock_adapter, test_user_id):
|
|
|
293
295
|
query_conditions, # adjust_conditions doesn't change this specific query_conditions
|
|
294
296
|
[('name', 'ASC')],
|
|
295
297
|
10,
|
|
296
|
-
0
|
|
298
|
+
0,
|
|
299
|
+
active=True # VersionedModel passes active=True
|
|
297
300
|
)
|
|
298
301
|
|
|
299
302
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rococo-1.2.0 → rococo-1.2.1}/rococo/repositories/surrealdb/person_organization_role_repository.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|