Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expeditions with campaigns #138

Open
wants to merge 10 commits into
base: development
Choose a base branch
from
Open

Expeditions with campaigns #138

wants to merge 10 commits into from

Conversation

0xVance
Copy link
Contributor

@0xVance 0xVance commented Nov 7, 2022

Key takeaways:

  • logic moved to services. For easiness of use all have been created as singletons (manual dependency injection, something like NestJS/angular does)
  • controllers have been divided so that e2e tests are not in a single file
  • issue with week - 1 doesn't exist when using dayjs.isoweek
  • added campaign model that limits time when all functionalities are working and can be collected
  • claiming messages have been reduced so that they are same as tasks enums
  • endpoints have been limited to two: claim & progress
  • added linting

Copy link
Contributor

@adamazad adamazad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job!

*/
type: WeeklyFragmentsType;

campaign_id: Types.ObjectId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this also be camel case? :)

Comment on lines +2 to +6
common = 'common',
uncommon = 'uncommon',
rare = 'rare',
epic = 'epic',
legendary = 'legendary',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enums should be all caps

address: string;
lastVisit: Date;
allVisits: number;
campaign_id: Types.ObjectId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


export interface AddressWithId {
address: string;
campaign_id: Types.ObjectId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

required: true,
default: 0,
},
campaign_id: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here?

max: MAX_WEEKLY_CLAIM_FRAGMENT,
min: 0,
},
campaign_id: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This

@@ -0,0 +1 @@
export const ADD_CAMPAIGN_MESSAGE = 'AddCampaign';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constants?

Comment on lines +21 to +25
validateSignature({
address,
signature,
message: ADD_CAMPAIGN_MESSAGE,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice implementation!

Comment on lines +27 to +39
const newCampaign = await campaignsService.addCampaign({
address,
endDate,
startDate,
redeemEndDate,
});

return {
startDate: newCampaign.startDate,
endDate: newCampaign.endDate,
redeemEndDate: newCampaign.redeemEndDate,
initiatorAddress: newCampaign.initiatorAddress,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destruct and return?

import { VisitModel } from '../../models/Visit.model';

export enum DailyFragmentsTypes {
VISIT = 'DAILY_VISIT',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VISIT = 'DAILY_VISIT',
DAILY_VISIT = 'DAILY_VISIT',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants