Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update QuestionService Endpoints and Documentation #33

Merged
merged 20 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use ESlint for indentation
KhoonSun47 committed Sep 24, 2024
commit 04d1b5d77ff284c1d2940aae5bd41194696217bf
2 changes: 1 addition & 1 deletion services/question/src/models/counterModel.ts
Original file line number Diff line number Diff line change
@@ -16,4 +16,4 @@ const counterSchema = new Schema<ICounter>({
},
});

export const Counter = model<ICounter>('Counter', counterSchema);
export const Counter = model<ICounter>('Counter', counterSchema);
8 changes: 2 additions & 6 deletions services/question/src/utils/sequence.ts
Original file line number Diff line number Diff line change
@@ -10,11 +10,7 @@ export async function initializeCounter() {
if (maxQuestion) {
maxId = maxQuestion.id;
}
await Counter.findOneAndUpdate(
{ _id: 'questionId' },
{ $set: { sequence_value: maxId } },
{ upsert: true },
);
await Counter.findOneAndUpdate({ _id: 'questionId' }, { $set: { sequence_value: maxId } }, { upsert: true });
console.log(`Question ID initialized to start from: ${maxId}`);
}

@@ -30,4 +26,4 @@ export const getNextSequenceValue = async (sequenceName: string): Promise<number
);
console.log(`Updated Question ID: ${counter.sequence_value}`);
return counter.sequence_value;
};
};