-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ certif: Call specific endpoint fro session
- Loading branch information
Showing
43 changed files
with
552 additions
and
260 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
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,36 @@ | ||
import { service } from '@ember/service'; | ||
|
||
import ApplicationAdapter from './application'; | ||
|
||
export default class SessionEnrolmentAdapter extends ApplicationAdapter { | ||
@service currentUser; | ||
|
||
pathForType(_) { | ||
return 'sessions'; | ||
} | ||
|
||
urlForCreateRecord() { | ||
const certificationCenterId = this.currentUser.currentAllowedCertificationCenterAccess.id; | ||
return `${this.host}/${this.namespace}/certification-centers/${certificationCenterId}/session`; | ||
} | ||
|
||
updateRecord(store, type, snapshot) { | ||
if (snapshot.adapterOptions) { | ||
if (snapshot.adapterOptions.studentListToAdd.length) { | ||
const url = this.urlForUpdateRecord(snapshot.id, type.modelName, snapshot) + '/enrol-students-to-session'; | ||
const organizationLearnerIds = snapshot.adapterOptions.studentListToAdd.map((student) => student.id); | ||
const data = { | ||
data: { | ||
attributes: { | ||
'organization-learner-ids': organizationLearnerIds, | ||
}, | ||
}, | ||
}; | ||
|
||
return this.ajax(url, 'PUT', { data }); | ||
} | ||
} | ||
|
||
return super.updateRecord(...arguments); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// eslint-disable-next-line ember/no-computed-properties-in-native-classes | ||
import { computed } from '@ember/object'; | ||
import { service } from '@ember/service'; | ||
import Model, { attr } from '@ember-data/model'; | ||
import ENV from 'pix-certif/config/environment'; | ||
|
||
export const CREATED = 'created'; | ||
|
||
export default class Session extends Model { | ||
@service session; | ||
@service featureToggles; | ||
@service intl; | ||
|
||
@attr('string') address; | ||
@attr('string') accessCode; | ||
@attr('date-only') date; | ||
@attr('string') time; | ||
@attr('string') description; | ||
@attr('string') examiner; | ||
@attr('string') room; | ||
@attr('string') status; | ||
@attr('string') supervisorPassword; | ||
@attr() certificationCenterId; | ||
@attr('number') version; | ||
|
||
@computed('id') | ||
get urlToDownloadAttendanceSheet() { | ||
return `${ENV.APP.API_HOST}/api/sessions/${this.id}/attendance-sheet`; | ||
} | ||
|
||
@computed('id') | ||
get urlToDownloadCandidatesImportTemplate() { | ||
return `${ENV.APP.API_HOST}/api/sessions/${this.id}/candidates-import-sheet`; | ||
} | ||
|
||
@computed('id') | ||
get urlToUpload() { | ||
return `${ENV.APP.API_HOST}/api/sessions/${this.id}/certification-candidates/import`; | ||
} | ||
} |
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
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
Oops, something went wrong.