2021-10-08 10:53:56 +02:00
|
|
|
import {Model as BaseModel, PluralResponse} from 'coloquent';
|
2021-10-08 13:07:18 +02:00
|
|
|
import {snakeCase} from 'lodash-es';
|
2021-09-29 18:07:35 +02:00
|
|
|
|
|
|
|
export default class Model extends BaseModel {
|
2021-10-08 10:53:56 +02:00
|
|
|
/**
|
|
|
|
* Just an alias to the get() method
|
|
|
|
*/
|
|
|
|
static all(): Promise<PluralResponse<InstanceType<Model>>> {
|
|
|
|
return this.get();
|
2021-09-29 18:07:35 +02:00
|
|
|
}
|
|
|
|
|
2021-10-08 12:33:05 +02:00
|
|
|
getAttribute(attributeName: string): any {
|
|
|
|
return super.getAttribute(attributeName);
|
|
|
|
}
|
|
|
|
|
2021-10-08 10:53:56 +02:00
|
|
|
getJsonApiBaseUrl(): string {
|
|
|
|
return '/api';
|
2021-09-29 20:29:08 +02:00
|
|
|
}
|
|
|
|
|
2021-10-08 10:53:56 +02:00
|
|
|
getJsonApiType(): string {
|
|
|
|
return (super.getJsonApiType() ?? snakeCase(this.constructor.name));
|
2021-09-29 18:07:35 +02:00
|
|
|
}
|
|
|
|
}
|