UNPKG

phx-node

Version:

PHX NODE

118 lines 4.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MUTATION_UPDATE_READ_NOTIFICATION_IN_DETAIL_FORM = exports.MUTATION_INSERT_NOTIFICATION = exports.MUTATION_UPDATE_READ_NOTIFICATION = exports.MUTATION_UPDATE_NOTIFICATION_UNREAD = exports.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = exports.QUERY_GET_LIST_NOTIFICATION_BY_ACTION = void 0; const graphql_request_1 = require("graphql-request"); exports.QUERY_GET_LIST_NOTIFICATION_BY_ACTION = (0, graphql_request_1.gql) ` query MyQuery( $app: String! $device_id: String! $user_id: Int! $offset: Int! $limit: Int! $hostname: String! $action: [String!]! $filter: String! ) { feature_mobile_push( where: { deleted_at: { _is_null: true } app: { _eq: $app } is_seen: { _eq: false } is_success: {_eq: true} device_id: { _eq: $device_id } user_id: { _eq: $user_id } hostname: { _eq: $hostname } action: {_in: $action} info_target: {_cast: {String: {_ilike: $filter}}} } limit: $limit offset: $offset order_by: { created_at: desc } ) { id payload action module_code info_target } } `; const QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = (studentCode) => ` query MyQuery( $hostname: String! $app: String! $device_id: String! $user_id: Int! $module_code: String! $action: String! ) { feature_mobile_push_count_notification_unread( where: { deleted_at: { _is_null: true } hostname: { _eq: $hostname } app: { _eq: $app } device_id: { _eq: $device_id } user_id: { _eq: $user_id } module_code: { _eq: $module_code } action: { _eq: $action } ${studentCode ? `student_code: {_eq: "${studentCode}"}` : ''} } ) { total_notification total_notification_important } } `; exports.QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE = QUERY_GET_STATISTICAL_NOTIFICATION_UNREAD_BY_MODULE; const MUTATION_UPDATE_NOTIFICATION_UNREAD = ({ studentCode, action }) => ` mutation MyMutation($hostname: String!, $app: String!, $device_id: String!, $module_code: String!, $user_id: Int!, $total_notification: Int!, $total_notification_important: Int!) { update_feature_mobile_push_count_notification_unread(where: {deleted_at: {_is_null: true}, hostname: {_eq: $hostname}, module_code: {_eq: $module_code}, app: {_eq: $app}, device_id: {_eq: $device_id}, user_id: {_eq: $user_id}, ${action ? `action: {_eq: "${action}"}` : ''}, ${studentCode ? `student_code: {_eq: "${studentCode}"}` : ''}}, _set: {total_notification: $total_notification, total_notification_important: $total_notification_important, updated_at: "now"}) { returning { id total_notification total_notification_important module_code } } } `; exports.MUTATION_UPDATE_NOTIFICATION_UNREAD = MUTATION_UPDATE_NOTIFICATION_UNREAD; exports.MUTATION_UPDATE_READ_NOTIFICATION = (0, graphql_request_1.gql) ` mutation MyMutation($id: Int!) { update_feature_mobile_push( where: { id: { _eq: $id }, is_seen: { _eq: false } } _set: { is_seen: true, updated_at: "now" } ) { returning { type module_code action payload } } } `; exports.MUTATION_INSERT_NOTIFICATION = ` mutation MyMutation($total_notification: Int!, $total_notification_important: Int!, $user_id: Int!, $hostname: String!, $app: String!, $device_id: String!, $module_code: String!, $action: String = null, $student_code: String = null) { insert_feature_mobile_push_count_notification_unread(objects: {app: $app, created_at: "now", hostname: $hostname, module_code: $module_code, total_notification: $total_notification, total_notification_important: $total_notification_important, user_id: $user_id, device_id: $device_id, action: $action, student_code: $student_code}) { returning { total_notification_important total_notification module_code } } } `; exports.MUTATION_UPDATE_READ_NOTIFICATION_IN_DETAIL_FORM = (0, graphql_request_1.gql) ` mutation MyMutation($app: String!, $device_id: String!, $user_id: Int!, $hostname: String!, $action: String!, $form_id: Int!) { update_feature_mobile_push(where: {deleted_at: {_is_null: true}, app: {_eq: $app}, is_seen: {_eq: false}, is_success: {_eq: true}, device_id: {_eq: $device_id}, user_id: {_eq: $user_id}, hostname: {_eq: $hostname}, action: {_eq: $action}, info_target: {_contains: {form_id: $form_id}}}, _set: {is_seen: true, updated_at: "now"}) { returning { type module_code payload action } } } `; //# sourceMappingURL=query.js.map