chore: ticket service but not tested

This commit is contained in:
mahyargdz
2025-01-28 20:08:43 +03:30
parent 239099bb15
commit 1d11509371
28 changed files with 368 additions and 73 deletions
+15 -20
View File
@@ -114,38 +114,33 @@ export class UsersService {
return { message: CommonMessage.VALID_FOR_CHOOSE };
}
///****************************************************** */
// async roleSeeder() {
// const countRole = await this.roleRepository.count();
// if (countRole > 0) return;
// const createdRoles = await this.roleRepository.insert(roles);
// this.logger.log({ createdRoles });
// return createdRoles;
// }
async createUserGroup(createUserGroupDto: CreateUserGroupDto) {
const users = await this.userRepository.find({ where: { id: In(createUserGroupDto.userIds) } });
const userGroup = this.userGroupRepository.create({
...createUserGroupDto,
users,
});
console.log({ userGroup });
return await this.userGroupRepository.save(userGroup);
await this.userGroupRepository.save(userGroup);
return {
message: UserMessage.USER_GROUP_CREATED,
};
}
///****************************************************** */
async getUserGroup() {
const usersGroup = await this.userGroupRepository.find({});
async getUserGroups() {
const usersGroup = await this.userGroupRepository.find({ relations: { users: true } });
return {
usersGroup,
};
}
///****************************************************** */
// async roleSeeder() {
// const countRole = await this.roleRepository.count();
// if (countRole > 0) return;
// const createdRoles = await this.roleRepository.insert(roles);
// this.logger.log({ createdRoles });
// return createdRoles;
// }
async getUserGroupById(id: string) {
const userGroup = await this.userGroupRepository.findGroupById(id);
if (!userGroup) throw new BadRequestException(UserMessage.USER_GROUP_NOT_FOUND);
return {
userGroup,
};
}
}