Refactor ApiServerContext to Simplify Filter Structure
- Updated filter structure in fetchObjects calls within ApiServerProvider to remove unnecessary object notation, enhancing code clarity and maintainability. - Streamlined data fetching logic for user notifiers, improving overall performance and readability of the context component.
This commit is contained in:
parent
6e8ad1c412
commit
8ab44fc9da
@ -2408,8 +2408,8 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
if (!userProfile?._id) return { data: [] }
|
if (!userProfile?._id) return { data: [] }
|
||||||
const result = await fetchObjects('userNotifier', {
|
const result = await fetchObjects('userNotifier', {
|
||||||
filter: {
|
filter: {
|
||||||
'user._id': userProfile._id,
|
user: userProfile._id,
|
||||||
'object._id': objectId,
|
object: objectId,
|
||||||
objectType
|
objectType
|
||||||
},
|
},
|
||||||
limit: 1
|
limit: 1
|
||||||
@ -2420,7 +2420,7 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
const fetchAllUserNotifiersForObject = async (objectId, objectType) => {
|
const fetchAllUserNotifiersForObject = async (objectId, objectType) => {
|
||||||
const result = await fetchObjects('userNotifier', {
|
const result = await fetchObjects('userNotifier', {
|
||||||
filter: {
|
filter: {
|
||||||
'object._id': objectId,
|
object: objectId,
|
||||||
objectType
|
objectType
|
||||||
},
|
},
|
||||||
limit: 100
|
limit: 100
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user