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

refactoring one #385

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions api/src/controllers/communityGroupController.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const addGroups = async (req, res) => {
}

const followGroup = await db.sequelize.transaction(async (t) => {
const group = await db.Group.create({ ...req.body, communityId: req.params.id, creatorId: req.user.id, slug: '', filename: 'uploads/' + filename }, { transaction: t })
const group = await db.Group.create({ ...req.body, communityId: req.params.id, creatorId: req.user.id, slug: '', filename: `uploads/${filename}` }, { transaction: t })
await db.GroupUser.create({ userId: req.user.id, groupId: group.id }, { transaction: t })
return true
})
Expand Down Expand Up @@ -251,7 +251,7 @@ const updateGroups = (req, res) => {

if (filename) {
db.Group.update({
title, description, category, filename: 'group/' + filename
title, description, category, filename: `group/${filename}`
},
{ where: { id } })
.then(() => res.json({ message: 'Groups Updated !!!' }).status(200))
Expand All @@ -278,7 +278,7 @@ const searchGroupsTitle = (req, res) => {
const order = req.query.order || 'ASC'

db.Group.findAll({
where: { title: { [Op.iLike]: '%' + title + '%' } },
where: { title: { [Op.iLike]: `%${title}%` } },
order: [['title', order]],
include: [{
model: db.Community,
Expand Down