Skip to content

Commit 3a6fa43

Browse files
chore: typeNotIn -> excludeTypes
1 parent 8a18485 commit 3a6fa43

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/database/dao/documents_v2_dao.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ abstract interface class DocumentsV2Dao {
2323
DocumentRef? referencing,
2424
});
2525

26-
/// Deletes documents from the database, preserving those with types in [typeNotIn].
26+
/// Deletes documents from the database, preserving those with types in [excludeTypes].
2727
///
28-
/// If [typeNotIn] is null or empty, this may delete *all* documents (implementation dependent).
28+
/// If [excludeTypes] is null or empty, this may delete *all* documents (implementation dependent).
2929
/// Typically used for cache invalidation or cleaning up old data while keeping
3030
/// certain important types (e.g. keeping local drafts or templates).
3131
///
3232
/// Returns the number of deleted rows.
3333
Future<int> deleteWhere({
34-
List<DocumentType>? typeNotIn,
34+
List<DocumentType>? excludeTypes,
3535
});
3636

3737
/// Checks if a document exists in the database.
@@ -164,12 +164,12 @@ class DriftDocumentsV2Dao extends DatabaseAccessor<DriftCatalystDatabase>
164164

165165
@override
166166
Future<int> deleteWhere({
167-
List<DocumentType>? typeNotIn,
167+
List<DocumentType>? excludeTypes,
168168
}) {
169169
final query = delete(documentsV2);
170170

171-
if (typeNotIn != null) {
172-
query.where((tbl) => tbl.type.isNotInValues(typeNotIn));
171+
if (excludeTypes != null) {
172+
query.where((tbl) => tbl.type.isNotInValues(excludeTypes));
173173
}
174174

175175
return query.go();

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/database/dao/local_draft_documents_v2_dao.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class DriftLocalDraftDocumentsV2Dao extends DatabaseAccessor<DriftCatalystDataba
3232
@override
3333
Future<int> deleteWhere({
3434
DocumentRef? ref,
35-
List<DocumentType>? typeNotIn,
35+
List<DocumentType>? excludeTypes,
3636
}) {
3737
final query = delete(localDocumentsDrafts);
3838

39-
if (typeNotIn != null) {
40-
query.where((tbl) => tbl.type.isNotInValues(typeNotIn));
39+
if (excludeTypes != null) {
40+
query.where((tbl) => tbl.type.isNotInValues(excludeTypes));
4141
}
4242

4343
return query.go();
@@ -346,7 +346,7 @@ abstract interface class LocalDraftDocumentsV2Dao {
346346

347347
Future<int> deleteWhere({
348348
DocumentRef? ref,
349-
List<DocumentType>? typeNotIn,
349+
List<DocumentType>? excludeTypes,
350350
});
351351

352352
Future<bool> exists(DocumentRef ref);

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/document/document_repository.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ final class DocumentRepositoryImpl implements DocumentRepository {
410410
bool keepLocalDrafts = false,
411411
}) async {
412412
final deletedDrafts = keepLocalDrafts ? 0 : await _drafts.delete();
413-
final typeNotIn = keepLocalDrafts ? [DocumentType.proposalTemplate] : null;
414-
final deletedDocuments = await _localDocuments.delete(typeNotIn: typeNotIn);
413+
final excludeTypes = keepLocalDrafts ? [DocumentType.proposalTemplate] : null;
414+
final deletedDocuments = await _localDocuments.delete(excludeTypes: excludeTypes);
415415

416416
return deletedDrafts + deletedDocuments;
417417
}

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/document/source/database_documents_data_source.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ final class DatabaseDocumentsDataSource
3434

3535
@override
3636
Future<int> delete({
37-
List<DocumentType>? typeNotIn,
37+
List<DocumentType>? excludeTypes,
3838
}) {
39-
return _database.documentsV2Dao.deleteWhere(typeNotIn: typeNotIn);
39+
return _database.documentsV2Dao.deleteWhere(excludeTypes: excludeTypes);
4040
}
4141

4242
@override

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/document/source/database_drafts_data_source.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ final class DatabaseDraftsDataSource implements DraftDataSource {
2424
@override
2525
Future<int> delete({
2626
DocumentRef? ref,
27-
List<DocumentType>? typeNotIn,
27+
List<DocumentType>? excludeTypes,
2828
}) {
29-
return _database.localDocumentsV2Dao.deleteWhere(ref: ref, typeNotIn: typeNotIn);
29+
return _database.localDocumentsV2Dao.deleteWhere(ref: ref, excludeTypes: excludeTypes);
3030
}
3131

3232
@override

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/document/source/document_data_local_source.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ abstract interface class DocumentDataLocalSource implements DocumentDataSource {
2020

2121
/// Deletes documents matching the provided filters.
2222
///
23-
/// * [typeNotIn]: If provided, deletes all documents *except* those
23+
/// * [excludeTypes]: If provided, deletes all documents *except* those
2424
/// matching the types in this list.
2525
///
2626
/// Returns the number of records deleted.
2727
Future<int> delete({
28-
List<DocumentType>? typeNotIn,
28+
List<DocumentType>? excludeTypes,
2929
});
3030

3131
/// Checks if a specific document exists in local storage.

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/document/source/local_document_data_local_source.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ abstract interface class DraftDataSource implements DocumentDataLocalSource {
99
/// Deletes drafts matching the criteria.
1010
///
1111
/// * [ref]: If provided, deletes the specific draft.
12-
/// * [typeNotIn]: Deletes all drafts NOT matching these types (often used for cleanup).
12+
/// * [excludeTypes]: Deletes all drafts NOT matching these types (often used for cleanup).
1313
@override
1414
Future<int> delete({
1515
DocumentRef? ref,
16-
List<DocumentType>? typeNotIn,
16+
List<DocumentType>? excludeTypes,
1717
});
1818

1919
/// Updates the content of an existing draft identified by [ref].

catalyst_voices/packages/internal/catalyst_voices_repositories/test/src/database/dao/documents_v2_dao_test.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ void main() {
16991699

17001700
// When
17011701
final result = await dao.deleteWhere(
1702-
typeNotIn: [DocumentType.proposalDocument],
1702+
excludeTypes: [DocumentType.proposalDocument],
17031703
);
17041704

17051705
// Then
@@ -1739,7 +1739,7 @@ void main() {
17391739

17401740
// When
17411741
final result = await dao.deleteWhere(
1742-
typeNotIn: [
1742+
excludeTypes: [
17431743
DocumentType.proposalDocument,
17441744
DocumentType.proposalTemplate,
17451745
],
@@ -1785,7 +1785,7 @@ void main() {
17851785
await dao.saveAll(entities);
17861786

17871787
// When
1788-
final result = await dao.deleteWhere(typeNotIn: []);
1788+
final result = await dao.deleteWhere(excludeTypes: []);
17891789

17901790
// Then
17911791
expect(result, 2);
@@ -1810,7 +1810,7 @@ void main() {
18101810

18111811
// When
18121812
final result = await dao.deleteWhere(
1813-
typeNotIn: [DocumentType.proposalDocument],
1813+
excludeTypes: [DocumentType.proposalDocument],
18141814
);
18151815

18161816
// Then
@@ -1839,7 +1839,7 @@ void main() {
18391839

18401840
// When
18411841
final result = await dao.deleteWhere(
1842-
typeNotIn: [DocumentType.proposalDocument],
1842+
excludeTypes: [DocumentType.proposalDocument],
18431843
);
18441844

18451845
// Then
@@ -1880,7 +1880,7 @@ void main() {
18801880

18811881
// When
18821882
final result = await dao.deleteWhere(
1883-
typeNotIn: [
1883+
excludeTypes: [
18841884
DocumentType.proposalDocument,
18851885
DocumentType.proposalTemplate,
18861886
DocumentType.proposalActionDocument,
@@ -1906,7 +1906,7 @@ void main() {
19061906

19071907
// When
19081908
final result = await dao.deleteWhere(
1909-
typeNotIn: [DocumentType.proposalDocument],
1909+
excludeTypes: [DocumentType.proposalDocument],
19101910
);
19111911

19121912
// Then

0 commit comments

Comments
 (0)