-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e3c0c2
commit e4fbaac
Showing
8 changed files
with
125 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Sources/VernissageServer/Extensions/QueryBuilder+Status.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// https://mczachurski.dev | ||
// Copyright © 2024 Marcin Czachurski and the repository contributors. | ||
// Licensed under the Apache License 2.0. | ||
// | ||
|
||
import Vapor | ||
import Fluent | ||
|
||
extension QueryBuilder<Status> { | ||
func filter(id: Int64?) -> Self { | ||
guard let id else { | ||
return self | ||
} | ||
|
||
return self.filter(\.$id == id) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Sources/VernissageServer/Extensions/QueryBuilder+User.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// https://mczachurski.dev | ||
// Copyright © 2024 Marcin Czachurski and the repository contributors. | ||
// Licensed under the Apache License 2.0. | ||
// | ||
|
||
import Vapor | ||
import Fluent | ||
|
||
extension QueryBuilder<User> { | ||
func filter(id: Int64?) -> Self { | ||
guard let id else { | ||
return self | ||
} | ||
|
||
return self.filter(\.$id == id) | ||
} | ||
|
||
func filter(userName: String?) -> Self { | ||
guard let userName else { | ||
return self | ||
} | ||
|
||
return self.filter(\.$userNameNormalized == userName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters