2024-04-24 05:17:32 +08:00
|
|
|
import { gql } from '@apollo/client';
|
|
|
|
|
|
|
|
const PLUGIN_DATA_CHANNEL_NEW_ITEMS = gql`
|
2024-06-18 20:20:35 +08:00
|
|
|
subscription FetchPluginDataChannelEntry($pluginName: String!,
|
2024-04-24 05:17:32 +08:00
|
|
|
$channelName: String! , $createdAt: timestamptz!, $subChannelName: String!){
|
|
|
|
pluginDataChannelEntry_stream(
|
|
|
|
cursor: {initial_value: {createdAt: $createdAt}}, batch_size: 100,
|
|
|
|
where: {
|
|
|
|
pluginName: { _eq: $pluginName }
|
|
|
|
channelName: { _eq: $channelName }
|
|
|
|
subChannelName: { _eq: $subChannelName }
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
createdAt,
|
|
|
|
channelName,
|
|
|
|
subChannelName,
|
|
|
|
entryId,
|
|
|
|
payloadJson,
|
2024-06-19 04:46:17 +08:00
|
|
|
createdBy,
|
2024-04-24 05:17:32 +08:00
|
|
|
pluginName,
|
|
|
|
toRoles,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const PLUGIN_DATA_CHANNEL_All_ITEMS = gql`
|
2024-06-18 20:20:35 +08:00
|
|
|
subscription FetchPluginDataChannelEntry($pluginName: String!,
|
2024-04-24 05:17:32 +08:00
|
|
|
$channelName: String!, $subChannelName: String!
|
|
|
|
){
|
|
|
|
pluginDataChannelEntry(
|
|
|
|
order_by: {createdAt: desc},
|
|
|
|
where: {
|
|
|
|
pluginName: { _eq: $pluginName }
|
|
|
|
channelName: { _eq: $channelName }
|
|
|
|
subChannelName: { _eq: $subChannelName }
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
createdAt,
|
|
|
|
channelName,
|
|
|
|
subChannelName,
|
|
|
|
entryId,
|
|
|
|
payloadJson,
|
2024-06-19 04:46:17 +08:00
|
|
|
createdBy,
|
2024-04-24 05:17:32 +08:00
|
|
|
pluginName,
|
|
|
|
toRoles,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const PLUGIN_DATA_CHANNEL_LATEST_ITEM = gql`
|
2024-06-18 20:20:35 +08:00
|
|
|
subscription FetchPluginDataChannelEntry($pluginName: String!,
|
2024-04-24 05:17:32 +08:00
|
|
|
$channelName: String!, $subChannelName: String!
|
|
|
|
){
|
|
|
|
pluginDataChannelEntry(
|
|
|
|
order_by: {createdAt: desc},
|
|
|
|
limit: 1,
|
|
|
|
where: {
|
|
|
|
pluginName: { _eq: $pluginName }
|
|
|
|
channelName: { _eq: $channelName }
|
|
|
|
subChannelName: { _eq: $subChannelName }
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
createdAt,
|
|
|
|
channelName,
|
|
|
|
subChannelName,
|
|
|
|
entryId,
|
|
|
|
payloadJson,
|
2024-06-19 04:46:17 +08:00
|
|
|
createdBy,
|
2024-04-24 05:17:32 +08:00
|
|
|
pluginName,
|
|
|
|
toRoles,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export { PLUGIN_DATA_CHANNEL_LATEST_ITEM, PLUGIN_DATA_CHANNEL_NEW_ITEMS, PLUGIN_DATA_CHANNEL_All_ITEMS };
|