1
- /* eslint-disable no-unused-vars */
2
1
import models from 'models'
3
2
import db from 'models/_instance'
4
3
import useValidation from 'helpers/useValidation'
@@ -13,7 +12,9 @@ const { UserRole } = models
13
12
14
13
class UserRoleService {
15
14
/**
16
- * Create User Role
15
+ *
16
+ * @param formData
17
+ * @param txn Transaction Sequelize
17
18
*/
18
19
public static async create ( formData : UserRoleAttributes , txn ?: Transaction ) {
19
20
const values = useValidation ( schema . create , formData )
@@ -25,7 +26,9 @@ class UserRoleService {
25
26
}
26
27
27
28
/**
28
- * Find Or Create User Role
29
+ *
30
+ * @param formData
31
+ * @param txn Transaction Sequelize
29
32
*/
30
33
public static async findOrCreate (
31
34
formData : UserRoleAttributes ,
@@ -41,7 +44,8 @@ class UserRoleService {
41
44
}
42
45
43
46
/**
44
- * Delete UserRole by UserId
47
+ *
48
+ * @param id
45
49
*/
46
50
public static async deleteByUserId ( id : string ) {
47
51
await UserRole . destroy ( {
@@ -54,7 +58,11 @@ class UserRoleService {
54
58
}
55
59
56
60
/**
57
- * Delete UserRole not In RoleId
61
+ *
62
+ * @param id
63
+ * @param roles Array of String
64
+ * @example
65
+ * roles = ['id_1', 'id_2']
58
66
*/
59
67
public static async deleteNotInRoleId ( id : string , roles : [ ] ) {
60
68
await UserRole . destroy ( {
0 commit comments