2021-10-24 00:42:20 +00:00
|
|
|
import { BaseCRUDAPI } from "../_base";
|
2021-08-22 23:23:45 +00:00
|
|
|
|
|
|
|
const prefix = "/api";
|
|
|
|
|
|
|
|
export interface CreateUnit {
|
|
|
|
name: string;
|
|
|
|
abbreviation: string;
|
2021-08-28 04:05:02 +00:00
|
|
|
fraction: boolean;
|
2021-08-22 23:23:45 +00:00
|
|
|
description: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Unit extends CreateUnit {
|
|
|
|
id: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
const routes = {
|
|
|
|
unit: `${prefix}/units`,
|
|
|
|
unitsUnit: (tag: string) => `${prefix}/units/${tag}`,
|
|
|
|
};
|
|
|
|
|
|
|
|
export class UnitAPI extends BaseCRUDAPI<Unit, CreateUnit> {
|
|
|
|
baseRoute: string = routes.unit;
|
|
|
|
itemRoute = routes.unitsUnit;
|
|
|
|
}
|