-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(haskolagatt): Remove obsolete program course code (#16604)
* Dropping Course table and all code related to Program Course * Cleanup --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
10560f2
commit b86cd04
Showing
28 changed files
with
194 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
apps/services/university-gateway/migrations/20241024081539-drop-courses.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
async up(queryInterface) { | ||
return queryInterface.sequelize.transaction(async (transaction) => { | ||
await queryInterface.dropTable('program_course', { transaction }) | ||
await queryInterface.dropTable('course', { transaction }) | ||
}) | ||
}, | ||
|
||
async down(queryInterface, Sequelize) { | ||
return queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.createTable( | ||
'course', | ||
{ | ||
id: { | ||
type: Sequelize.UUID, | ||
primaryKey: true, | ||
allowNull: false, | ||
defaultValue: Sequelize.UUIDV4, | ||
}, | ||
external_id: { | ||
type: Sequelize.STRING, | ||
allowNull: false, | ||
}, | ||
name_is: { | ||
type: Sequelize.STRING, | ||
allowNull: false, | ||
}, | ||
name_en: { | ||
type: Sequelize.STRING, | ||
allowNull: false, | ||
}, | ||
university_id: { | ||
type: Sequelize.UUID, | ||
references: { | ||
model: 'university', | ||
key: 'id', | ||
}, | ||
allowNull: false, | ||
}, | ||
credits: { | ||
type: Sequelize.FLOAT, | ||
allowNull: false, | ||
}, | ||
description_is: { | ||
type: Sequelize.TEXT, | ||
allowNull: true, | ||
}, | ||
description_en: { | ||
type: Sequelize.TEXT, | ||
allowNull: true, | ||
}, | ||
external_url_is: { | ||
type: Sequelize.STRING(500), | ||
allowNull: true, | ||
}, | ||
external_url_en: { | ||
type: Sequelize.STRING(500), | ||
allowNull: true, | ||
}, | ||
created: { | ||
type: Sequelize.DATE, | ||
allowNull: false, | ||
}, | ||
modified: { | ||
type: Sequelize.DATE, | ||
allowNull: false, | ||
}, | ||
}, | ||
{ transaction: t }, | ||
) | ||
|
||
await queryInterface.createTable( | ||
'program_course', | ||
{ | ||
id: { | ||
type: Sequelize.UUID, | ||
primaryKey: true, | ||
defaultValue: Sequelize.UUIDV4, | ||
allowNull: false, | ||
}, | ||
program_id: { | ||
type: Sequelize.UUID, | ||
references: { | ||
model: 'program', | ||
key: 'id', | ||
}, | ||
allowNull: false, | ||
}, | ||
course_id: { | ||
type: Sequelize.UUID, | ||
onDelete: 'CASCADE', | ||
references: { | ||
model: 'course', | ||
key: 'id', | ||
}, | ||
allowNull: false, | ||
}, | ||
requirement: { | ||
type: Sequelize.ENUM( | ||
'MANDATORY', | ||
'FREE_ELECTIVE', | ||
'RESTRICTED_ELECTIVE', | ||
), | ||
allowNull: false, | ||
}, | ||
semester_year: { | ||
type: Sequelize.INTEGER, | ||
allowNull: true, | ||
}, | ||
semester_season: { | ||
type: Sequelize.ENUM( | ||
'FALL', | ||
'SPRING', | ||
'SUMMER', | ||
'WHOLE_YEAR', | ||
'ANY', | ||
), | ||
allowNull: false, | ||
}, | ||
created: { | ||
type: Sequelize.DATE, | ||
allowNull: false, | ||
}, | ||
modified: { | ||
type: Sequelize.DATE, | ||
allowNull: false, | ||
}, | ||
}, | ||
{ transaction: t }, | ||
) | ||
}) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 0 additions & 93 deletions
93
apps/services/university-gateway/src/app/modules/program/model/programCourse.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 4 additions & 24 deletions
28
...ricultural-university-of-iceland/src/lib/agriculturalUniversityOfIcelandClient.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,16 @@ | ||
import { Injectable } from '@nestjs/common' | ||
import { CoursesApi, ProgramsApi } from '../../gen/fetch/apis' | ||
import { ICourse, IProgram } from '@island.is/university-gateway' | ||
import { ProgramsApi } from '../../gen/fetch/apis' | ||
import { IProgram } from '@island.is/university-gateway' | ||
import { logger } from '@island.is/logging' | ||
import { | ||
mapUglaPrograms, | ||
mapUglaCourses, | ||
} from '@island.is/clients/university-application/university-of-iceland' | ||
import { mapUglaPrograms } from '@island.is/clients/university-application/university-of-iceland' | ||
|
||
@Injectable() | ||
export class AgriculturalUniversityOfIcelandApplicationClient { | ||
constructor( | ||
private readonly programsApi: ProgramsApi, | ||
private readonly coursesApi: CoursesApi, | ||
) {} | ||
constructor(private readonly programsApi: ProgramsApi) {} | ||
|
||
async getPrograms(): Promise<IProgram[]> { | ||
const res = await this.programsApi.activeProgramsGet() | ||
|
||
return mapUglaPrograms(res, 'agricultural-university-of-iceland') | ||
} | ||
|
||
async getCourses(programExternalId: string): Promise<ICourse[]> { | ||
const res = await this.coursesApi.programExternalIdCoursesGet({ | ||
externalId: programExternalId, | ||
// specializationExternalId // TODO missing in api | ||
}) | ||
|
||
return mapUglaCourses(res, (courseExternalId: string, e: Error) => { | ||
logger.error( | ||
`Failed to map course with externalId ${courseExternalId} for program with externalId ${programExternalId} (agricultural-university-of-iceland), reason:`, | ||
e, | ||
) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.