Skip to content

Commit

Permalink
Refactoring WeeklyDebrief
Browse files Browse the repository at this point in the history
  • Loading branch information
Aayush-Agnihotri committed Nov 12, 2023
1 parent 3eba4ef commit 2d6131f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
4 changes: 0 additions & 4 deletions src/entities/WeeklyDebrief.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ export default class WeeklyDebrief {
@Property({ default: 0 })
numShoutouts?: number;

@Field()
@Property({ default: 0 })
numBookmarkedArticles?: number;

@Field()
@Property({ default: 0 })
numReadArticles?: number;
Expand Down
2 changes: 0 additions & 2 deletions src/repos/WeeklyDebriefRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const createWeeklyDebrief = async (
creationDate,
expirationDate,
numShoutouts: user.numShoutouts,
numBookmarkedArticles: user.numBookmarkedArticles,
readArticles: user.readArticles.slice(0, 2),
readMagazines: user.readMagazines.slice(0, 2),
numReadArticles: user.readArticles.length,
Expand All @@ -36,7 +35,6 @@ const createWeeklyDebrief = async (
readArticles: [],
readMagazines: [],
numShoutouts: 0,
numBookmarkedArticles: 0,
weeklyDebrief,
},
},
Expand Down
13 changes: 0 additions & 13 deletions src/tests/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,6 @@ describe('weekly debrief tests:', () => {
expect(getUsersResponse.numShoutouts).toEqual(1);
});

test('incrementBookmarks - 1 user, 1 shoutout', async () => {
const users = await UserFactory.create(1);
const insertOutput = await UserModel.insertMany(users);
await UserRepo.incrementBookmarks(insertOutput[0].uuid);

// update database
const pub = await PublicationFactory.getRandomPublication();
await UserRepo.followPublication(users[0].uuid, pub.slug);

const getUsersResponse = await UserRepo.getUserByUUID(insertOutput[0].uuid);
expect(getUsersResponse.numBookmarkedArticles).toEqual(1);
});

test('appendReadFlyer', async () => {
const users = await UserFactory.create(1);
const flyers = await FlyerFactory.create(1);
Expand Down

0 comments on commit 2d6131f

Please sign in to comment.