mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-07-13 02:53:45 +00:00
feat(*): Add region-game mappings
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import RegionGameMappingModel, { type RegionGameMapping } from '$lib/models/RegionGameMapping';
|
||||
|
||||
class RegionGameMappingRepository {
|
||||
async findById(id: string): Promise<RegionGameMapping | null> {
|
||||
return RegionGameMappingModel.findById(id).exec();
|
||||
}
|
||||
|
||||
async findAll(): Promise<RegionGameMapping[]> {
|
||||
return RegionGameMappingModel.find().exec();
|
||||
}
|
||||
|
||||
async create(data: Partial<RegionGameMapping>): Promise<RegionGameMapping> {
|
||||
return RegionGameMappingModel.create(data);
|
||||
}
|
||||
|
||||
async update(id: string, data: Partial<RegionGameMapping>): Promise<RegionGameMapping | null> {
|
||||
return RegionGameMappingModel.findByIdAndUpdate(id, data, { new: true }).exec();
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<void> {
|
||||
await RegionGameMappingModel.findByIdAndDelete(id).exec();
|
||||
}
|
||||
}
|
||||
|
||||
export default RegionGameMappingRepository;
|
||||
Reference in New Issue
Block a user