Skip to content

Commit 6b2278d

Browse files
committed
refactored rating resolvers
1 parent 849ef20 commit 6b2278d

File tree

15 files changed

+1202
-724
lines changed

15 files changed

+1202
-724
lines changed

package-lock.json

Lines changed: 7 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"bcryptjs": "^2.4.3",
6666
"cloudinary": "^1.30.1",
6767
"cors": "^2.8.5",
68-
"date-fns": "^2.29.2",
68+
"date-fns": "^4.1.0",
6969
"dotenv": "^16.0.1",
7070
"ejs": "^3.1.8",
7171
"express": "^4.18.1",

src/models/cohort.model.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ const cohortSchema = new Schema(
6262
ref: 'Organization',
6363
required: true,
6464
},
65+
isDeleted: {
66+
type: Boolean,
67+
default: false
68+
}
6569
},
6670
{
6771
statics: {

src/models/program.model.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const programSchema = new Schema(
2626
required: true,
2727
default: true,
2828
},
29+
isDeleted: {
30+
type: Boolean,
31+
default: false
32+
}
2933
},
3034
{
3135
toObject: { virtuals: true },

src/models/ratings.ts

Lines changed: 5 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ const RatingSchema = new Schema(
88
required: true,
99
},
1010
sprint: {
11-
type: Number,
11+
type: Schema.Types.ObjectId,
12+
ref: 'Sprint',
1213
required: true,
1314
},
1415
phase: {
15-
type: String,
16+
type: Schema.Types.ObjectId,
17+
ref: 'Phase',
1618
required: true,
1719
},
1820
quantity: {
@@ -46,20 +48,11 @@ const RatingSchema = new Schema(
4648
type: Boolean,
4749
default: true,
4850
},
49-
coordinator: {
50-
type: Schema.Types.ObjectId,
51-
ref: 'User',
52-
required: true,
53-
},
5451
cohort: {
5552
type: Schema.Types.ObjectId,
5653
ref: 'Cohort',
5754
required: true,
5855
},
59-
average: {
60-
type: String,
61-
required: false,
62-
},
6356
organization: {
6457
type: Schema.Types.ObjectId,
6558
ref: 'Organization',
@@ -71,76 +64,4 @@ const RatingSchema = new Schema(
7164

7265
const Rating = mongoose.model('Rating', RatingSchema)
7366

74-
const TempData = mongoose.model(
75-
'TempData',
76-
new Schema(
77-
{
78-
user: {
79-
type: Schema.Types.ObjectId,
80-
ref: 'User',
81-
required: true,
82-
},
83-
sprint: {
84-
type: Number,
85-
required: true,
86-
},
87-
quantity: {
88-
type: [String],
89-
default: [],
90-
},
91-
quality: {
92-
type: [String],
93-
default: [],
94-
},
95-
professional_Skills: {
96-
type: [String],
97-
default: [],
98-
},
99-
feedbacks: [
100-
{
101-
sender: {
102-
type: Schema.Types.ObjectId,
103-
ref: 'User',
104-
},
105-
content: {
106-
type: String,
107-
},
108-
createdAt: {
109-
type: Date,
110-
default: new Date(),
111-
},
112-
},
113-
],
114-
oldFeedback: {
115-
type: [String],
116-
default: [],
117-
},
118-
coordinator: {
119-
type: Schema.Types.ObjectId,
120-
ref: 'Cohort',
121-
required: true,
122-
},
123-
cohort: {
124-
type: Schema.Types.ObjectId,
125-
ref: 'Cohort',
126-
required: true,
127-
},
128-
approved: {
129-
type: Boolean,
130-
default: false,
131-
},
132-
average: {
133-
type: String,
134-
required: false,
135-
},
136-
organization: {
137-
type: Schema.Types.ObjectId,
138-
ref: 'Organization',
139-
required: true,
140-
},
141-
},
142-
{ timestamps: true }
143-
)
144-
)
145-
146-
export { Rating, TempData }
67+
export default Rating

src/models/sprint.model.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {Schema, Types, model} from "mongoose"
2+
3+
interface ISprint{
4+
phase: Types.ObjectId,
5+
sprintNbr: number,
6+
organization: Types.ObjectId,
7+
startDate: String,
8+
endDate: String,
9+
isDeleted: boolean,
10+
}
11+
12+
const sprintSchema = new Schema<ISprint>({
13+
phase:{
14+
type: Schema.Types.ObjectId,
15+
required: true,
16+
},
17+
sprintNbr:{
18+
type: Number,
19+
required: true,
20+
},
21+
organization:{
22+
type: Schema.Types.ObjectId,
23+
ref:'Organization',
24+
required: true,
25+
},
26+
startDate:{
27+
type: String,
28+
required: true,
29+
},
30+
endDate:{
31+
type: String,
32+
required: true,
33+
},
34+
isDeleted: {
35+
type: Boolean,
36+
default: false,
37+
required: true,
38+
}
39+
})
40+
41+
const Sprint = model<ISprint>('sprint', sprintSchema)
42+
export default Sprint

src/models/team.model.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ const teamSchema = new Schema(
6464
default: true,
6565
required: true,
6666
},
67+
isDeleted: {
68+
type: Boolean,
69+
default: false
70+
}
6771
},
6872
{
6973
statics: {

src/models/user.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import bcrypt from 'bcryptjs'
22
import mongoose, { model, Types, Schema, Model } from 'mongoose'
33
import { Profile } from './profile.model'
4-
import { Rating } from './ratings';
4+
import Rating from './ratings';
55

66
export enum USER_STATUS_ENUM{
77
ACTIVE="active",
@@ -163,6 +163,10 @@ const userSchema = new Schema<IUser, UserModel, IUserMethods>(
163163
dateOfBirth: {
164164
type: Date,
165165
},
166+
isDeleted: {
167+
type: Boolean,
168+
default: false
169+
}
166170
},
167171

168172
{

0 commit comments

Comments
 (0)