UNPKG

@overture-stack/lyric

Version:
49 lines (48 loc) 1.85 kB
import { ListAllCategoriesResponse } from 'src/utils/types.js'; import { Dictionary as SchemasDictionary } from '@overture-stack/lectern-client'; import { Category, Dictionary, NewCategory } from '@overture-stack/lyric-data-model/models'; import { BaseDependencies } from '../config/config.js'; declare const repository: (dependencies: BaseDependencies) => { /** * Save a new Category in Database * @param data A Category object to be saved * @returns The created Category */ save: (data: NewCategory) => Promise<Category>; categoryIdExists: (categoryId: number) => Promise<boolean>; /** * Get a list of category names and id * @returns {Promise<ListAllCategoriesResponse[]>} */ getAllCategoryNames: () => Promise<ListAllCategoriesResponse[]>; /** * Find a Category by Id * @param {number} id Category id * @returns The Category found */ getCategoryById: (id: number) => Promise<(Category & { activeDictionary: Dictionary | null; }) | undefined>; /** * Find a Category matching a category name * @param {string} name Category name * @returns The Category found */ getCategoryByName: (name: string) => Promise<Category | undefined>; /** * Finds the current Dictionary for a Category * @param {number} categoryId Category ID * @returns The current Dictionary for this category */ getActiveDictionaryByCategory: (categoryId: number) => Promise<(SchemasDictionary & { id: number; }) | undefined>; /** * Update a Category record in database * @param categoryId The Category ID * @param newData Set fields to update * @returns The updated record */ update: (categoryId: number, newData: Partial<Category>) => Promise<Category>; }; export default repository;