Skip to content

Commit 14c9f28

Browse files
Fix trainee attendance (#385)
* fix(attendance): move attendance calculation logic from client to server * fix-trainee-attendance --------- Co-authored-by: aimedivin <[email protected]>
1 parent 10ba88d commit 14c9f28

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/resolvers/userResolver.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const resolvers: any = {
115115
Query: {
116116

117117
async getOrganizations(_: any, __: any, context: Context) {
118-
; (await checkUserLoggedIn(context))([RoleOfUser.SUPER_ADMIN])
118+
;(await checkUserLoggedIn(context))([RoleOfUser.SUPER_ADMIN])
119119

120120
return Organization.find()
121121
},
@@ -169,7 +169,7 @@ const resolvers: any = {
169169
{ organisation, username }: any,
170170
context: Context
171171
) {
172-
; (await checkUserLoggedIn(context))([
172+
;(await checkUserLoggedIn(context))([
173173
RoleOfUser.ADMIN,
174174
RoleOfUser.COORDINATOR,
175175
'trainee',
@@ -181,7 +181,7 @@ const resolvers: any = {
181181
name: organisation,
182182
})
183183
if (!organisationExists)
184-
throw new Error('This Organization doesn\'t exist')
184+
throw new Error("This Organization doesn't exist")
185185

186186
organisation = organisationExists.gitHubOrganisation
187187

@@ -531,9 +531,9 @@ const resolvers: any = {
531531
]
532532
const org = await checkLoggedInOrganization(orgToken)
533533
const roleExists = allRoles.includes(name)
534-
if (!roleExists) throw new Error('This role doesn\'t exist')
534+
if (!roleExists) throw new Error("This role doesn't exist")
535535
const userExists = await User.findById(id)
536-
if (!userExists) throw new Error('User doesn\'t exist')
536+
if (!userExists) throw new Error("User doesn't exist")
537537

538538
const getAllUsers = await User.find({
539539
role: RoleOfUser.ADMIN,
@@ -770,7 +770,7 @@ const resolvers: any = {
770770
context: Context
771771
) {
772772
// check if requester is super admin
773-
; (await checkUserLoggedIn(context))([RoleOfUser.SUPER_ADMIN])
773+
;(await checkUserLoggedIn(context))([RoleOfUser.SUPER_ADMIN])
774774
const orgExists = await Organization.findOne({ name: name })
775775
if (action == 'approve') {
776776
if (!orgExists) {
@@ -840,7 +840,7 @@ const resolvers: any = {
840840
context: Context
841841
) {
842842
// the below commented line help to know if the user is an superAdmin to perform an action of creating an organization
843-
; (await checkUserLoggedIn(context))([RoleOfUser.SUPER_ADMIN])
843+
;(await checkUserLoggedIn(context))([RoleOfUser.SUPER_ADMIN])
844844
if (action == 'new') {
845845
const orgExists = await Organization.findOne({ name: name })
846846
if (orgExists) {
@@ -905,7 +905,7 @@ const resolvers: any = {
905905
{ name, gitHubOrganisation }: any,
906906
context: Context
907907
) {
908-
; (await checkUserLoggedIn(context))([
908+
;(await checkUserLoggedIn(context))([
909909
RoleOfUser.ADMIN,
910910
RoleOfUser.SUPER_ADMIN,
911911
])
@@ -998,15 +998,15 @@ const resolvers: any = {
998998
},
999999

10001000
async deleteOrganization(_: any, { id }: any, context: Context) {
1001-
; (await checkUserLoggedIn(context))([
1001+
;(await checkUserLoggedIn(context))([
10021002
RoleOfUser.ADMIN,
10031003
RoleOfUser.SUPER_ADMIN,
10041004
])
10051005

10061006
const organizationExists = await Organization.findOne({ _id: id })
10071007

10081008
if (!organizationExists)
1009-
throw new Error('This Organization doesn\'t exist')
1009+
throw new Error("This Organization doesn't exist")
10101010
await Cohort.deleteMany({ organization: id })
10111011
await Team.deleteMany({ organization: id })
10121012
await Phase.deleteMany({ organization: id })
@@ -1084,7 +1084,7 @@ const resolvers: any = {
10841084
if (password === confirmPassword) {
10851085
const user: any = await User.findOne({ email })
10861086
if (!user) {
1087-
throw new Error('User doesn\'t exist! ')
1087+
throw new Error("User doesn't exist! ")
10881088
}
10891089
user.password = password
10901090
await user.save()

src/schema/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const Schema = gql`
192192
description: String
193193
}
194194
195-
type Rating {
195+
type Rating {
196196
id: ID!
197197
user: User!
198198
sprint: Int!
@@ -206,6 +206,8 @@ const Schema = gql`
206206
cohort: Cohort!
207207
average: String
208208
feedbacks: [RatingMessageTemp]
209+
createdAt: String
210+
updatedAt: String
209211
}
210212
211213
type AddRating {

0 commit comments

Comments
 (0)