Skip to content

Commit

Permalink
Zach/trendiness and migration hot fix (#107)
Browse files Browse the repository at this point in the history
* Add migration script to update data based on new Flyers schema

* Update Flyer trendiness

* Fix comments

* Clean up syntax for get trending flyers

* Remove unnecessary createSpecificsByIndex function

* Fix TypeScript compilation error
  • Loading branch information
zachseidner1 authored Sep 14, 2023
1 parent d43a4f5 commit cc16b13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ApolloServer } from 'apollo-server-express';
import ArticleResolver from './resolvers/ArticleResolver';
import ArticleRepo from './repos/ArticleRepo';
import { dbConnection } from './db/DBConnection';
import FlyerRepo from './repos/FlyerRepo';
import FlyerResolver from './resolvers/FlyerResolver';
import MagazineRepo from './repos/MagazineRepo';
import MagazineResolver from './resolvers/MagazineResolver';
Expand Down Expand Up @@ -86,12 +85,10 @@ const main = async () => {
// Refresh trending articles, magazines, and flyers once
ArticleRepo.refreshTrendingArticles();
MagazineRepo.refreshFeaturedMagazines();
FlyerRepo.refreshTrendingFlyers();
// Refresh trending articles, magazines, and flyers every 12 hours
cron.schedule('0 */12 * * *', async () => {
ArticleRepo.refreshTrendingArticles();
MagazineRepo.refreshFeaturedMagazines();
FlyerRepo.refreshTrendingFlyers();
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/tests/flyer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ describe('getTrending tests', () => {
});
});


describe('getFlyersByCategorySlug tests', () => {
test('query flyer with invalid slug', async () => {
const flyers = await FlyerFactory.create(2);
Expand Down Expand Up @@ -293,4 +294,4 @@ describe('deleteFlyer tests', () => {
const deleteFlyerResponse = await FlyerRepo.deleteFlyer('64811792f910705ca1a981f8');
expect(deleteFlyerResponse).toBeNull();
});
});
});

0 comments on commit cc16b13

Please sign in to comment.