UNPKG

phx-node

Version:

PHX NODE

229 lines 5.74 kB
"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_V2 = 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; //lấy ra tất cả các năm học đang hoạt động của tất cả các trường 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.LIST_ACTIVE_SCHOOL_YEAR_QUERY_V2 = ` query MyQuery($schoolId: Int!) { allCoreSharedPublicSchoolYears( filter: {startAt: {lessThanOrEqualTo: "now"}, endAt: {greaterThanOrEqualTo: "now"}, deletedAt: {isNull: true}, schoolId: {equalTo: $schoolId}} ) { nodes { rowId startAt endAt code name coreSharedPublicSchoolCourseBySchoolCourseIdAndSchoolId { coreSharedPublicSchoolBySchoolId { rowId coreSharedPublicProgramsBySchoolId(filter: {deletedAt: {isNull: true}}) { nodes { rowId code } } coreSharedPublicEducationalLevelsBySchoolId(filter: {deletedAt: {isNull: true}}) { nodes { rowId code } } } } coreSharedPublicSchoolTermsBySchoolYearIdAndSchoolId( filter: {deletedAt: {isNull: true}} ) { nodes { rowId startAt endAt coefficient code name } totalCount } } } } `; //lấy ra năm học đang hoạt động và năm học tiếp theo theo trường học 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 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 } school_terms_aggregate(where: {deleted_at: {_is_null: true}}) { aggregate { count } } } } `; //lấy ra tất cả các năm học tiếp theo của tất cả các trường 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