mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-03 18:53:17 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			475 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			475 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { BaseCRUDAPI } from "./_base";
 | 
						|
 | 
						|
const prefix = "/api";
 | 
						|
 | 
						|
export interface CreateUnit {
 | 
						|
  name: string;
 | 
						|
  abbreviation: string;
 | 
						|
  fraction: boolean;
 | 
						|
  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;
 | 
						|
}
 |