Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ package-lock.json
node_modules/.package-lock.json
node_modules/accepts/HISTORY.md
.env
/.vs
4 changes: 0 additions & 4 deletions src/api/Controllers/ProgramCourseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const getAllPrograms = async (req, res) => {
let response = await ProgramService.SearchProgram(top, page,limit, search)

return res.status(200).json({
code:res.statusCode,
response
})

Expand All @@ -45,8 +44,6 @@ const updateProgram = async (req, res) => {
const { message } = await ProgramService.updateProgram(req.body);

res.status(200).json({
code:200,
data: data,
message
});
} catch (err) {
Expand All @@ -60,7 +57,6 @@ const deleteProgram = async (req, res) => {
const { message } = await ProgramService.deleteProgram(req.params.id);

return res.status(200).json({
code: 200,
message
});
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/Models/programcourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default (sequelize) => {
{
sequelize,
modelName: 'ProgramCourse',
timestamps: true,
timestamps: false,
}
);

Expand Down
22 changes: 11 additions & 11 deletions src/api/Services/ProgramCourseServices.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import { fileURLToPath } from 'url';
import { DataTypes } from 'sequelize';
import { DataTypes, Op } from 'sequelize';
import sequelize from '../../Config/db.js';
import ProgramCourseModelFactory from '../Models/programcourse.js';

Expand Down Expand Up @@ -98,8 +98,8 @@ const SearchProgram = async (top,page,limit,search) => {
page = parseInt(page, 10);
limit = parseInt(limit, 10);
queryOptions.limit = limit;
queryOptions.offset = (page - 1) * limit; // ✅ fixed parseDecimal
}
queryOptions.offset = (page - 1) * limit; // ✅ fixed parseDecimal
}

// Wildcard search
if (search) {
Expand All @@ -113,15 +113,15 @@ const SearchProgram = async (top,page,limit,search) => {
};
}

const programs = await ProgramCourse.findAll(queryOptions);
const programs = await ProgramCourse.findAll(queryOptions);

return {
programs,
pagination: {
page: page || null,
limit: queryOptions.limit || null,
total: programs.length
}
return {
programs,
pagination: {
page: page || null,
limit: queryOptions.limit || null,
total: programs.length
}
};
} catch (error) {
throw error;
Expand Down
Loading