Skip to content

Commit

Permalink
temp changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Nov 21, 2023
1 parent ff0835d commit e7c61e9
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 19 deletions.
32 changes: 21 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@ AUTHORIZED_PANEL_LOCAL='http://localhost:3001'
AUTHORIZED_DOCS_LOCAL='http://127.0.0.0:8002'




AUTHORIZED_DAPP_PRODUCTION=''

ALCHEMY_KEY_SEPOLIA=
ALCHEMY_KEY_MAIN=

ALCHEMY_SEPOLIA="https://eth-sepolia.g.alchemy.com/v2/<Key>"
NFT_STORAGE_KEY=


DB_FLASK_HOST=localhost
DB_FLASK_USER=nest
DB_FLASK_PASS=
DB_FLASK_NAME=say
DB_FLASK_HOST=
DB_FLASK_USER=
DB_FLASK_PASS=
DB_FLASK_NAME=

DOMAIN_LOCAL=api.sayapp.company
DOMAIN_STAGING=api.s.sayapp.company
Expand All @@ -32,6 +26,22 @@ NEST_SERVER_DEV=localhost:8002
NEST_SERVER_STAGING=s.nest.saydao.org
NEST_SERVER_PROD=nest.saydao.org

# email
MAIL_HOST=
MAIL_FROM=
MAIL_PASSWORD=
SAY_ADMIN_EMAIL=

# sms
SMS_FROM=
SAY_ADMIN_SMS=
SMS_USER=
SMS_PASSWORD=

# end points
INFURA_KEY=
ALCHEMY_KEY=
QUICK_NODE_KEY=
GET_BLOCK_KEY=

DB_HOST=

1 change: 1 addition & 0 deletions src/features/children/children.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ export class ChildrenService {
async getPreChildrenNames(): Promise<ChildrenPreRegisterEntity[]> {
return await this.preRegisterChildrenRepository
.createQueryBuilder('child')
.where('child.status != :status', { status: PreRegisterStatusEnum.CONFIRMED })
.select(['child.sayName'])
.getMany();
}
Expand Down
14 changes: 7 additions & 7 deletions src/features/schedule/schedule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,21 @@ export class ScheduleService {
}
}

// @Cron('00 13 * * Thu', {
// name: 'MonthlyCampaigns try At 13:00 on Thursday.', // we try every week and only send to those who did not receive (because their child have no needs, etc.)
// timeZone: 'Asia/Tehran',
// })
@Cron('00 13 * * Thu', {
name: 'MonthlyCampaigns try At 13:00 on Thursday.', // we try every week and only send to those who did not receive (because their child have no needs, etc.)
timeZone: 'Asia/Tehran',
})
@Timeout(5000)
async handleSummaryMailCron() {
// const farsiDay = persianDay(new Date())
// if (farsiDay > 20) {
// this.logger.warn(`We are near the end of this month let's skip one more week`);
// return
// }
// if (process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
this.logger.debug('Sending user Campaigns at 02:00 PM, only on Sunday');
// await this.campaignService.sendUserMonthlyCampaigns();
// }
}
}

@Cron('30 8 * * Mon', {
Expand All @@ -149,7 +149,7 @@ export class ScheduleService {
async handleReminderMailCron() {
if (process.env.NODE_ENV === 'production') {
this.logger.debug('Sending Reminder to Social workers');
// await this.campaignService.sendSwChildNoNeedReminder();
await this.campaignService.sendSwChildNoNeedReminder();
}
}
}
13 changes: 13 additions & 0 deletions src/features/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,17 @@ export class UserController {
theUser.contributions.forEach((c) => list.push(c.id));
return await this.userService.deleteOneContributor(theUser.id, list);
}

@Get('/temp')
async getAvailableContributions(@Req() req: Request) {
const users = await this.userService.getUsers();
for await(const user of users){
await this.userService.temp(user.id)
}


}



}
12 changes: 11 additions & 1 deletion src/features/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class UserService {
private flaskSocialWorkerRepository: Repository<SocialWorker>,
@InjectRepository(User, 'flaskPostgres')
private flaskUserRepository: Repository<User>,
) {}
) { }

getFlaskSwIds(): Promise<SocialWorker[]> {
return this.flaskSocialWorkerRepository.find({
Expand Down Expand Up @@ -287,4 +287,14 @@ export class UserService {
}
return from(this.allUserRepository.delete(userId));
}


async temp(
userId: string,
): Promise<UpdateResult> {
return this.allUserRepository.update(userId, {
monthlyCampaign: true,
});
}

}

0 comments on commit e7c61e9

Please sign in to comment.