From fc9f919161674e7ef4e5f6fee9313fc009f7f132 Mon Sep 17 00:00:00 2001 From: Arthur <110528300+c0rydoras@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:15:16 +0100 Subject: [PATCH] refactor(frontend): use javascripts extends instead of Thing.extend (#548) --- frontend/app/adapters/activity-block.js | 12 ++++++------ frontend/app/serializers/attendance.js | 13 ++++--------- frontend/app/serializers/employment.js | 13 ++++--------- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/frontend/app/adapters/activity-block.js b/frontend/app/adapters/activity-block.js index ae5488ce2..84f076928 100644 --- a/frontend/app/adapters/activity-block.js +++ b/frontend/app/adapters/activity-block.js @@ -12,7 +12,7 @@ import ApplicationAdapter from "timed/adapters/application"; * @extends ApplicationAdapter * @public */ -export default ApplicationAdapter.extend({ +export default class ActivityBlockAdapter extends ApplicationAdapter { /** * Custom url for updating records * @@ -24,8 +24,8 @@ export default ApplicationAdapter.extend({ * @public */ urlForUpdateRecord(...args) { - return `${this._super(...args)}?include=activity`; - }, + return `${super.urlForUpdateRecord(...args)}?include=activity`; + } /** * Custom url for creating records @@ -38,6 +38,6 @@ export default ApplicationAdapter.extend({ * @public */ urlForCreateRecord(...args) { - return `${this._super(...args)}?include=activity`; - }, -}); + return `${super.urlForCreateRecord(...args)}?include=activity`; + } +} diff --git a/frontend/app/serializers/attendance.js b/frontend/app/serializers/attendance.js index d2ddaf624..e665c10a0 100644 --- a/frontend/app/serializers/attendance.js +++ b/frontend/app/serializers/attendance.js @@ -12,20 +12,15 @@ import ApplicationSerializer from "timed/serializers/application"; * @extends ApplicationSerializer * @public */ -export default ApplicationSerializer.extend({ +export default class AttendanceSerializer extends ApplicationSerializer { /** * The attribute mapping * * This mapps some properties of the response to another * property name of the model - * - * @property {Object} attrs - * @property {String} from - * @property {String} to - * @public */ - attrs: { + attrs = { from: "from-time", to: "to-time", - }, -}); + }; +} diff --git a/frontend/app/serializers/employment.js b/frontend/app/serializers/employment.js index de54c6c2b..ddb55f9e3 100644 --- a/frontend/app/serializers/employment.js +++ b/frontend/app/serializers/employment.js @@ -12,20 +12,15 @@ import ApplicationSerializer from "timed/serializers/application"; * @extends ApplicationSerializer * @public */ -export default ApplicationSerializer.extend({ +export default class EmploymentSerializer extends ApplicationSerializer { /** * The attribute mapping * * This mapps some properties of the response to another * property name of the model - * - * @property {Object} attrs - * @property {String} start - * @property {String} end - * @public */ - attrs: { + attrs = { start: "start-date", end: "end-date", - }, -}); + }; +}