Skip to content

Commit

Permalink
launch
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Oct 10, 2023
1 parent 05fb1ab commit 9ac0423
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 68 deletions.
63 changes: 0 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,4 @@

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.

## Installation

```bash
$ npm install
```

## Running the app

```bash
# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
```

## Test

```bash
# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov
```

## Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).

## Stay in touch

- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)

## License

Nest is [MIT licensed](LICENSE).
6 changes: 5 additions & 1 deletion src/features/family/family.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ export class FamilyController {
});

// confirm duration
const confirmDuration = daysDifference(need.created, need.confirmDate);
let confirmDuration = daysDifference(need.created, need.confirmDate);
if (confirmDuration < 0) {
// some data from 2019 have wrong confirm dates, such as need 35
confirmDuration = 0;
}
const confirmsInRange = await this.needService.getConfirmsInRange(
need.confirmDate,
need.category,
Expand Down
9 changes: 7 additions & 2 deletions src/features/midjourney/midjourney.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ export class MidjourneyController {
const limit = X_LIMIT > 100 ? 100 : X_LIMIT;
const page = X_TAKE + 1;
const needsWithSignatures =
await this.midjourneyService.getReadyToSignNeeds({
await this.midjourneyService.getOnlyReadyToMidjourney({
page: page,
limit: limit,
path: '',
});
const count = await this.midjourneyService.countAllNeedJourney();

const list = [];

Expand All @@ -135,7 +136,11 @@ export class MidjourneyController {
});
}
});
return { total: needsWithSignatures.meta.totalItems, list };
return {
totalReady: needsWithSignatures.meta.totalItems,
total: count,
list,
};
}

@ApiFileResponse('image/png')
Expand Down
32 changes: 30 additions & 2 deletions src/features/midjourney/midjourney.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class MidjourneyService {
return await this.needService.getNeedByFlaskId(flaskNeedId);
}

async getReadyToSignNeeds(
async getOnlyReadyToMidjourney(
options: PaginateQuery,
): Promise<Paginated<NeedEntity>> {
const queryBuilder = this.needRepository
Expand All @@ -125,12 +125,40 @@ export class MidjourneyService {
)
.where('signature.role = :role', {
role: SAYPlatformRoles.SOCIAL_WORKER,
});
})
.andWhere('need.midjourneyImage IS NULL');

return await nestPaginate<NeedEntity>(options, queryBuilder, {
sortableColumns: ['id'],
defaultSortBy: [['createdAt', 'DESC']],
nullSort: 'last',
});
}

async countAllNeedJourney(): Promise<number> {
return await this.needRepository
.createQueryBuilder('need')
.leftJoinAndMapOne(
'need.ngo',
NgoEntity,
'ngo',
'ngo.flaskNgoId = need.flaskNgoId',
)
.leftJoinAndMapMany(
'need.verifiedPayments',
PaymentEntity,
'verifiedPayments',
'verifiedPayments.flaskNeedId = need.flaskId',
)
.leftJoinAndMapMany(
'need.signatures',
SignatureEntity,
'signature',
'signature.flaskNeedId = need.flaskId',
)
.where('signature.role = :role', {
role: SAYPlatformRoles.SOCIAL_WORKER,
})
.getCount();
}
}

0 comments on commit 9ac0423

Please sign in to comment.