Skip to content

Commit 6e84435

Browse files
committed
fix: user role service
1 parent 5c13139 commit 6e84435

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/controllers/UserRole/service.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-unused-vars */
21
import models from 'models'
32
import db from 'models/_instance'
43
import useValidation from 'helpers/useValidation'
@@ -13,7 +12,9 @@ const { UserRole } = models
1312

1413
class UserRoleService {
1514
/**
16-
* Create User Role
15+
*
16+
* @param formData
17+
* @param txn Transaction Sequelize
1718
*/
1819
public static async create(formData: UserRoleAttributes, txn?: Transaction) {
1920
const values = useValidation(schema.create, formData)
@@ -25,7 +26,9 @@ class UserRoleService {
2526
}
2627

2728
/**
28-
* Find Or Create User Role
29+
*
30+
* @param formData
31+
* @param txn Transaction Sequelize
2932
*/
3033
public static async findOrCreate(
3134
formData: UserRoleAttributes,
@@ -41,7 +44,8 @@ class UserRoleService {
4144
}
4245

4346
/**
44-
* Delete UserRole by UserId
47+
*
48+
* @param id
4549
*/
4650
public static async deleteByUserId(id: string) {
4751
await UserRole.destroy({
@@ -54,7 +58,11 @@ class UserRoleService {
5458
}
5559

5660
/**
57-
* Delete UserRole not In RoleId
61+
*
62+
* @param id
63+
* @param roles Array of String
64+
* @example
65+
* roles = ['id_1', 'id_2']
5866
*/
5967
public static async deleteNotInRoleId(id: string, roles: []) {
6068
await UserRole.destroy({

0 commit comments

Comments
 (0)