Skip to content

Commit

Permalink
fix: parse correct boolean for verification
Browse files Browse the repository at this point in the history
  • Loading branch information
jkklapp committed Jun 7, 2022
1 parent 1c7e8f8 commit df0ded5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backend/src/posts/posts.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,18 @@ export class PostsController {
@Body() post: NewPostDocument,
): Promise<ResolvedPostDocument> {
const { user } = request;
const { user_id: userId, name: userName, verified } = user;
const {
user_id: userId,
name: userName,
email_verified: emailVerified,
} = user;

const last24hours = Date.now() - 86400000;
const numberPostsCreatedToday = await this.service.countAllforUserByDate(
userId,
last24hours,
);
const maxNumberPostsPerDay = verified
const maxNumberPostsPerDay = emailVerified
? parseInt(process.env.MAX_NUMBER_POSTS_PER_DAY, 10)
: 1;
if (numberPostsCreatedToday >= maxNumberPostsPerDay) {
Expand Down

0 comments on commit df0ded5

Please sign in to comment.