-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.ts
165 lines (147 loc) · 4.5 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import { PubSub } from 'graphql-subscriptions';
export const IMAGES_SERVER_URL = '';
export const S3_BUCKET_NAME = '';
export const AWS_CONFIG_DATA = {
accessKeyId: '********************',
secretAccessKey: '****************************************',
region: '**-*********-*',
};
export const NO_REPLY_EMAIL = '';
export const SES_CONFIGURES = {};
export const MONGODB_URL = '';
export const FRONT_END_URL = '';
export const ROUTES = {
HealthCheck: '/healthcheck',
GraphQL: '/graphql',
Subscriptions: '/subscriptions',
};
export const DEFAULT_AVATAR_URL = '';
export const SALT_ROUNDS = 10; // For hash user password algorithm
export const CHARACTERS_CHAIN = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
export const ACTIVE_ACCOUNT_KEY_LENGTH = 128;
export const LOG_TYPES = {
Info: 0,
Error: 1,
};
export const MAXIMUM_ACTIVE_ACCOUNT_MAILS_IN_DAY = 5;
export const MAX_SUGGEST_USERS_COUNT = 20;
export const SUCCESS_MESSAGES = {
ActiveAccount: {
ActiveSuccess: 'Acitve account successfully',
},
Auth: {
SignUpSuccess: 'SignUp successfully',
SignInSuccess: 'SignIn successfully',
ComparePassword: 'Password matched',
},
Comment: {
AddCommentSuccess: 'Add comment successfully',
DeleteCommentSuccess: 'Delete comment successfully',
},
Follow: {
AlreadyFollow: 'Already has followed this user',
FollowUserSuccess: 'Follow user successfully',
},
Notification: {
MarkAsReadSuccess: 'Mark as read successfully',
BatchMarkAsReadSuccess: 'Batch mark as read successfully',
},
Post: {
CreatePostSuccess: 'Create post successfully',
DeletePostSuccess: 'Delete post successfully',
LikePostSuccess: 'Like post successfully',
UnlikePostSuccess: 'Unlike post successfully',
},
SendActiveEmail: {
Success: 'Send email successfully',
},
SuggestUsers: {
FetchSuccess: 'Fetch suggest users successfully',
},
Unfollow: {
HaveNotFollowed: 'You have not followed this user',
UnfollowUserSuccess: 'Unfollow user successfully',
},
User: {
UpdateUserSuccess: 'Update user successfully',
},
};
export const ERROR_MESSAGES = {
ActiveAccount: {
ActiveFailed: 'Acitve account failed',
NotRegisteredOrActivated:
'You haven\'t not registered an account or your account has been activated',
},
Auth: {
AccountNotExists: 'Account doesnt exist',
InvalidCredentials: 'Invalid Credentials',
EmailPassNotMatch: 'Email or Password does not match',
MustProvideEmailAndPass: 'You must provide an email and password',
MailInUse: 'Email is already in use',
Unauthen: 'You haven\'t signed in',
Unauthorized: 'Unauthorized',
ComparePassword: 'Password doesn\'t match',
},
Comment: {
AddCommentFailed: 'Add comment failed',
DeleteCommentFailed: 'Delete comment failed',
},
Commons: {
SystemError: 'System error occured',
},
Follow: {
AlreadyFollow: 'Already has followed this user',
FollowUserFailed: 'Follow user failed',
IsFollowingUser: 'Check follow relationship failed',
},
Notification: {
MarkAsReadFailed: 'Mark as read failed',
},
Post: {
AlreadyLikedPost: 'You have already liked this post',
CreatePostFailed: 'Create post failed',
DeletePostFailed: 'Delete post failed',
HaveNotLikedPost: 'You have not liked this post',
LikePostFailed: 'Like post failed',
UnlikePostFailed: 'Unlike post failed',
},
SendActiveEmail: {
MaximumMailInDayExceed: 'You can only send maximum 5 "active account emails" in day',
EmailUnregisteredOrEmailActivated:
'The account that has this email has been activated or hasn\'t registered yet',
},
SuggestUsers: {
LimitParamGreaterThanMaxCount:
'Limit parameter \'s value greater than max suggest users count',
},
Unfollow: {
HaveNotFollowed: 'You have not followed this user',
UnfollowUserFailed: 'Unfollow user failed',
},
User: {
UpdateUserFailed: 'Update user failed',
},
};
export const SYSTEM_ERROR_MESSAGES = {
Auth: {
UserDoesNotExist: 'Error: GraphQL error: Cannot read property \'comparePassword\' of null',
}
};
export const NotificationTypes = {
CommentPost: 0,
LikePost: 1,
Follow: 2,
};
export const TRIGGER_EVENTS = {
SignUp: 'SignUp',
SignIn: 'SignIn',
};
export const SUBSCRIPTION_TOPICS = {
CommentAdded: 'CommentAdded',
NotificationAdded: 'NotificationAdded',
PostAdded: 'PostAdded',
PostDeleted: 'PostDeleted',
PostLikeRelate: 'PostLikeRelate',
};
export const USER_POSTS_BATCH_SIZE = 9;
export const pubsub = new PubSub();