phx-node
Version:
PHX NODE
180 lines • 4.23 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LIST_NEXT_SCHOOL_YEAR_QUERY = exports.LIST_ACTIVE_SCHOOL_YEAR_AND_NEXT_SCHOOL_YEAR_QUERY = exports.ACTIVE_SCHOOL_YEAR_AND_NEXT_SCHOOL_YEAR_QUERY = exports.LIST_ACTIVE_SCHOOL_YEAR_QUERY = exports.querySchoolYear = void 0;
const querySchoolYear = (isAllTerm) => `
query MyQuery($school_id: Int!) {
school_year(
where: {
deleted_at: { _is_null: true }
school_course: { school_id: { _eq: $school_id } }
end_at: { _gte: "now" }
start_at: { _lte: "now" }
}
) {
id
name
code
start_at
end_at
school_terms(where: { deleted_at: { _is_null: true }, ${isAllTerm ? "" : 'end_at: { _gte: "now" }, start_at: { _lte: "now" }'}}) {
id
code
name
start_at
end_at
coefficient
}
}
}
`;
exports.querySchoolYear = querySchoolYear;
exports.LIST_ACTIVE_SCHOOL_YEAR_QUERY = `
query ListActiveSchoolYear {
school_year(
where: {
start_at: { _lte: "now" }
end_at: { _gte: "now" }
deleted_at: { _is_null: true }
}
) {
id
start_at
end_at
code
name
school_course {
school {
id
programs(where: { deleted_at: { _is_null: true } }) {
id
code
}
educational_levels(where: { deleted_at: { _is_null: true } }) {
id
code
}
}
}
school_terms(
where: { deleted_at: { _is_null: true } }
order_by: { start_at: asc }
) {
id
start_at
end_at
coefficient
code
name
}
school_terms_aggregate(where: { deleted_at: { _is_null: true } }) {
aggregate {
count
}
}
}
}
`;
exports.ACTIVE_SCHOOL_YEAR_AND_NEXT_SCHOOL_YEAR_QUERY = `
query ActiveAndNextSchoolYear(
$startAt: timestamptz!
$endAt: timestamptz!
$school_id: Int!
) {
school_year(
where: {
deleted_at: { _is_null: true }
start_at: { _lte: $startAt }
end_at: { _gte: $endAt }
school_course: { school_id: { _eq: $school_id } }
}
order_by: { id: asc }
) {
code
end_at
id
name
start_at
school_course {
course_name
id
code
}
}
}
`;
exports.LIST_ACTIVE_SCHOOL_YEAR_AND_NEXT_SCHOOL_YEAR_QUERY = `
query GetActiveAndNextSchoolYear($startAt: timestamptz, $endAt: timestamptz) {
school_year(where: {deleted_at: {_is_null: true}, start_at: {_lte: $startAt}, end_at: {_gte: $endAt}}, order_by: {id: asc}) {
id
start_at
end_at
school_course {
school {
id
programs(where: {deleted_at: {_is_null: true}}) {
id
code
}
educational_levels(where: {deleted_at: {_is_null: true}}) {
id
code
}
}
}
school_terms(where: {deleted_at: {_is_null: true}}, order_by: {start_at: asc}) {
id
start_at
end_at
coefficient
}
school_terms_aggregate(where: {deleted_at: {_is_null: true}}) {
aggregate {
count
}
}
}
}
`;
exports.LIST_NEXT_SCHOOL_YEAR_QUERY = `
query ListNextSchoolYear($nextYearDate: timestamptz!) {
school_year(
where: {
start_at: { _lte: $nextYearDate }
end_at: { _gte: $nextYearDate }
deleted_at: { _is_null: true }
}
) {
id
start_at
end_at
school_course {
school {
id
programs(where: { deleted_at: { _is_null: true } }) {
id
code
}
educational_levels(where: { deleted_at: { _is_null: true } }) {
id
code
}
}
}
school_terms(
where: { deleted_at: { _is_null: true } }
order_by: { start_at: asc }
) {
id
start_at
end_at
coefficient
}
school_terms_aggregate(where: { deleted_at: { _is_null: true } }) {
aggregate {
count
}
}
}
}
`;
//# sourceMappingURL=query.js.map