Skip to content

Conversation

@YouriDK
Copy link
Contributor

@YouriDK YouriDK commented Dec 19, 2025

Implementation of Clan roles a lil a bit late xD

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@YouriDK YouriDK force-pushed the 901---Clan-roles-(with-editable-name/permissions) branch from b411df7 to 803dfbd Compare December 22, 2025 01:39
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no clan role creation for the existing clans in the migration anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean ? Master of clan will be able to create clan to delegate, there was no initial role before except the master one

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh?
Previously, you had SQL queries in your migration file that created default roles for the existing clans, which led to me telling you not to use FOR clauses in your queries, but now, there's nothing like that in your current migration file

name String @db.VarChar(50)
// Permissions
permissions ClanPermission[] @default([])
members ClanMemberRole[]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something, by why don't we simply have an array of brutes here instead?
I don't see the use for an additional ClanMemberRole table

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not adding another table will implying we are sure that we won't need other datas ( like who assign who and other detail ). Adding datas will imply a roll back to a new table if we switch. i though that might a better way and prevent for next features

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I don't see the use for it, I'd rather keep everything simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the table ClanMemberRole and adapt the rest of the permissions with an array of brutes for members. I'll have some test to do

// Update the role
const role = await prisma.clanRole.update({
where: { id: roleId },
data: req.body,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather set the fields to update manually instead of trusting the body here.
You could abuse this to update tables linked to clan roles this way otherwise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumme that you want a more precise datas instead of the whole body like data: {
name: req.body.name,
permissions: req.body.permissions,
},

Copy link
Owner

@Zenoo Zenoo Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, with some minor checks against the variables, to check if they're the correct type, etc

Comment on lines 38 to 48
select: {
id: true,
masterOfClan: { select: { id: true } },
clanRoles: {
select: {
role: {
select: { permissions: true },
},
},
},
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? It's not used anywhere in the method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some logic was missing because we will need this to check for the role canSelectWarFighters , so this part is kinda use now

};


export const getBruteRoles = async (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? No I mean I don't see the method getBruteRoles used anywhere in your code

YouriDK and others added 2 commits December 29, 2025 17:50
Co-authored-by: Franck <perso@franckdemoute.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants