mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
asset viewer now viewing on tabs
Tabs is better for this yay Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
const { Course } = require('../../api/models/courses/courses.mdl');
|
||||
const Unit = require('../../api/models/courses/units.mdl');
|
||||
const Lesson = require('../../api/models/courses/lessons.mdl');
|
||||
const { TaskList, Task } = require('../../api/models/task/task.mdl');
|
||||
const Advertisement = require('../../api/models/advertisements/advertisements.mdl');
|
||||
const TierPlan = require('../../api/models/tiers/tier_plans.mdl');
|
||||
const { Op } = require('sequelize');
|
||||
|
||||
const QA_PREFIX = '[QA-TEST';
|
||||
|
||||
const TARGETS = [
|
||||
{ model: Task, column: 'name' },
|
||||
{ model: TaskList, column: 'name' },
|
||||
{ model: Advertisement, column: 'headline' },
|
||||
{ model: Unit, column: 'title' },
|
||||
{ model: Lesson, column: 'title' },
|
||||
{ model: Course, column: 'title' },
|
||||
{ model: TierPlan, column: 'label' },
|
||||
];
|
||||
|
||||
/** Hard-deletes every QA-TEST-prefixed fixture row across all modules this suite touches. */
|
||||
async function cleanupQaTestFixtures() {
|
||||
const removed = {};
|
||||
for (const { model, column } of TARGETS) {
|
||||
const count = await model.destroy({
|
||||
where: { [column]: { [Op.like]: `${QA_PREFIX}%` } },
|
||||
force: true, // hard delete, not just paranoid soft-delete — mirrors the manual "archive then permanently delete" cleanup flow
|
||||
});
|
||||
if (count) removed[model.name] = count;
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
module.exports = { cleanupQaTestFixtures, QA_PREFIX };
|
||||
Reference in New Issue
Block a user