Skip to content

Commit

Permalink
trying request in SQL and not with typeORM
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-pages committed Oct 21, 2024
1 parent 79a0bf8 commit a457acb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions server/controllers/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,16 @@ activityController.get({ path: '/mascotte', userType: UserType.OBSERVATOR }, asy
});

activityController.get({ path: '/admin/draft' }, async (req, res) => {
const adminUsers = await AppDataSource.getRepository(User)
.createQueryBuilder('User')
.select('User.id')
.where('User.type IN (:...types)', { types: [0, 1, 2] })
.getMany();

const userColumns = await AppDataSource.getRepository(User).query('SHOW COLUMNS FROM User');
console.log(userColumns);
// const adminUsers = await AppDataSource.getRepository(User)
// .createQueryBuilder('User')
// .select('User.id')
// .where('user.type IN (:...type)', { type: 0 })
// .getMany();
const adminUsers = await AppDataSource.query(`
SELECT User.id
FROM User
WHERE User.type IN (0, 1, 2)
`);

if (!req.query.isDisplayed) {
const draftActivities = await AppDataSource.getRepository(Activity)
Expand Down

0 comments on commit a457acb

Please sign in to comment.