Skip to content

Commit

Permalink
adjusted assignment flow for filters down to the return value
Browse files Browse the repository at this point in the history
  • Loading branch information
bwdmr committed Jan 2, 2025
1 parent cc66701 commit 9392e03
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/FluentKit/Query/Builder/QueryBuilder+Join.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ extension QueryBuilder {
) -> Self
where Foreign: Schema
{
let finalFilters: [DatabaseQuery.Filter]

// If deleted models aren't included, add filters
// to exclude them for each model being queried.
// If deleted models aren't included, add filters to exclude them for each model being queried.
if !self.includeDeleted {
let filters = foreign.excludeDeleted(from: filters)
return self.join(Foreign.self, on: .advancedJoin(schema: Foreign.schema, space: Foreign.space, alias: Foreign.alias, method, filters: filters))
finalFilters = foreign.excludeDeleted(from: filters)
} else {
finalFilters = filters
}

return self.join(Foreign.self, on: .advancedJoin(schema: Foreign.schema, space: Foreign.space, alias: Foreign.alias, method, filters: filters))
return self.join(Foreign.self, on: .advancedJoin(schema: Foreign.schema, space: Foreign.space, alias: Foreign.alias, method, filters: finalFilters))
}

/// `.join(Foreign.self, on: databaseJoin)`
Expand Down

0 comments on commit 9392e03

Please sign in to comment.