superdesk/superdesk-client-core

View on GitHub
scripts/extensions/markForUser/src/get-article-queries.tsx

Summary

Maintainability
A
0 mins
Test Coverage

export function getQueryMarkedForUser(userId: string): object {
    return {
        term: {
            marked_for_user: userId,
        },
    };
}

export function getQueryNotMarkedForAnyoneOrMarkedForMe(userId: string): object {
    return {
        bool: {
            should: [
                {
                    bool: {
                        must_not: {
                            exists: {
                                field: 'marked_for_user',
                            },
                        },
                    },
                },
                {...getQueryMarkedForUser(userId)},
            ],
        },
    };
}