File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ import practicalController from "#controller/practical";
44const router = express . Router ( ) ;
55
66// Create a new Practical
7- router . post ( "/practical/ create" , practicalController . addPractical ) ;
7+ router . post ( "/create" , practicalController . addPractical ) ;
88
99// List Practical entities with optional filters
10- router . get ( "/practical/ list" , practicalController . getPractical ) ;
10+ router . get ( "/list" , practicalController . getPractical ) ;
1111
1212// Update Practical entities based on filters and update data
13- router . post ( "/practical/ update/:id" , practicalController . updatePractical ) ;
13+ router . post ( "/update/:id" , practicalController . updatePractical ) ;
1414
1515// Delete Practical entities based on filters
16- router . delete ( "/practical/ delete/:id" , practicalController . deletePractical ) ;
16+ router . delete ( "/delete/:id" , practicalController . deletePractical ) ;
1717
1818export default router ;
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ export async function createPractical({
1919// Service function to update a Practical entity by ID
2020export async function updatePracticalById ( id , data ) {
2121 try {
22- const updated = await Practical . updateOne ( { _id : id } , data ) ;
23- if ( updated . nModified > 0 ) {
22+ const updated = await Practical . update ( { _id : id } , data ) ;
23+ if ( updated ) {
2424 return updated ;
2525 }
2626 throw new databaseError . DataEntryError ( "practical" ) ;
@@ -32,10 +32,10 @@ export async function updatePracticalById(id, data) {
3232// Service function to retrieve a list of Practical entities based on filters
3333export async function listPractical ( filter ) {
3434 try {
35- const practicalList = await Practical . find ( filter ) ;
35+ const practicalList = await Practical . read ( filter ) ;
3636 return practicalList ;
3737 } catch ( error ) {
38- throw new databaseError . DataRetrievalError ( "practical" ) ;
38+ throw new databaseError . DataEntryError ( "practical" ) ;
3939 }
4040}
4141
You can’t perform that action at this time.
0 commit comments