Skip to content

Commit

Permalink
quick fixes to feedback system
Browse files Browse the repository at this point in the history
  • Loading branch information
JSai23 committed Oct 25, 2024
1 parent 12e7924 commit a2beb1f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/models/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ let schema = new Schema({
of: SchemaTypes.Mixed,
default: {},
},
aitags_feedback: {
aitags_feedback: [{
type: Map,
of: SchemaTypes.Mixed,
default: {},
},
}],
aitagnames: { type: [String], default: [] },
red_flag: { type: Boolean, default: false, index: true }
});
Expand Down
8 changes: 7 additions & 1 deletion src/api/reports/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ interface IAITagsFeedback {
* ai tags feedback submissions
*/
export async function setAITagsFeedback(params: IAITagsFeedback) {
const combine = { ...params.report, aitags_feedback: params.aitags_feedback };
const combine = {
...params.report,
aitags_feedback: [
...(params.report.aitags_feedback || []),
params.aitags_feedback
]
};
console.log(combine);
const data = await editReport(combine);
return data;
Expand Down
1 change: 1 addition & 0 deletions src/api/reports/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface Report extends hasId {
__v: number;
aitags: GeneratedTags;
aitagnames: string[];
aitags_feedback: Record<string, unknown>[];
red_flag: boolean;
}

Expand Down

0 comments on commit a2beb1f

Please sign in to comment.