Skip to content

Commit

Permalink
Update prod (#393)
Browse files Browse the repository at this point in the history
* Create pr-to-prod.yml (#346)

* remove deploy rule (#349)

* remove deploy rule

* Update build-and-push-docker-image.yml

* Update build-and-push-docker-image.yml

* unblock wksp on plan changing (#352)

* Email notifications with priority (#339)

* Email notifications with priority

* Fix linter errors

* Remove sign-up email from templates

* Renamed default priority

* Added password-reset and workspace-invite emails (#356)

* improvement(repetitions): title and type added to Repetition payload (#358)

* [Feature] New integration token format (#357)

* upgrade hawk.types

* create project with new integration token format

* add resolver for regenerating token

* refactor generating token

* fix import

* refactor type of returned object

* Update projectsFactory.ts

* Update project.ts

* refactor generating integration id

* Update projectsFactory.ts

* generate integration id if not any (#360)

* Fix catcher problems

* Event repetitions pagination (#363)

* feat: Event repetitions load

* Fix lint

* Fix lint

* Add seed resolver for e2e env (#366)

* Add seed resolver for e2e env

* Add workspace model back

* Fix lint

* [Feature] Date from objectid (#370)

* add function for getting timestamp from object id

* return date from function, add resolver for project

* add resolvers for user and workspace to

* add test

* Send commits on build (#367)

* send commits on build

* add name to release id

* Bump version up to 1.0.1

* remove commits.sh

* update workflow

* Update build-and-push-docker-image.yml

* Update package.json

* test

* remove log

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Bump tmpl from 1.0.4 to 1.0.5 (#374)

Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump object-path from 0.11.5 to 0.11.8 (#373)

Bumps [object-path](https://github.com/mariocasciaro/object-path) from 0.11.5 to 0.11.8.
- [Release notes](https://github.com/mariocasciaro/object-path/releases)
- [Commits](https://github.com/mariocasciaro/object-path/commits)

---
updated-dependencies:
- dependency-name: object-path
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Taly <vitalik7tv@yandex.ru>

* Bump axios from 0.21.1 to 0.21.2 (#372)

* Bump axios from 0.21.1 to 0.21.2

Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](axios/axios@v0.21.1...v0.21.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump version up to 1.0.4

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Taly <vitalik7tv@yandex.ru>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Bump passport-oauth2 from 1.5.0 to 1.6.1 (#375)

Bumps [passport-oauth2](https://github.com/jaredhanson/passport-oauth2) from 1.5.0 to 1.6.1.
- [Release notes](https://github.com/jaredhanson/passport-oauth2/releases)
- [Changelog](https://github.com/jaredhanson/passport-oauth2/blob/master/CHANGELOG.md)
- [Commits](jaredhanson/passport-oauth2@v1.5.0...v1.6.1)

---
updated-dependencies:
- dependency-name: passport-oauth2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix workspace editing (#376)

* fix Validator importing

* remove JWT_SECRET_PROJECT_TOKEN from .env.sample

* Bump version up to 1.0.5

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Update user.ts

* Feature: hidden plans (#377)

* rename methods

* Update workspaceMutations.ts

* rename vars

* do not show hidden plans

* Bump version up to 1.0.6

* hawk.types -> @hawk.so/types

* update types

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* fix: do not add user to wksp without prompt (#381)

* Fix logic and add comments

* Bump version up to 1.0.7

* do not show invite pending wksp in the list

* rename method

addUnregisteredMember -> addMemberByEmail

* Update workspace.js

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* CORS added (#385)

* CORS added

* Bump version up to 1.0.8

* cors restricted

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* branch fixed (#389)

* `changeplan` updated with tariffPlanId (#390)

* change plan updated with tariffPlanId

* Bump version up to 1.0.8

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

* Bump nodemailer from 6.4.18 to 6.6.1 (#388)

Bumps [nodemailer](https://github.com/nodemailer/nodemailer) from 6.4.18 to 6.6.1.
- [Release notes](https://github.com/nodemailer/nodemailer/releases)
- [Changelog](https://github.com/nodemailer/nodemailer/blob/master/CHANGELOG.md)
- [Commits](nodemailer/nodemailer@v6.4.18...v6.6.1)

---
updated-dependencies:
- dependency-name: nodemailer
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump follow-redirects from 1.14.4 to 1.14.7 (#386)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.14.4...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* Fix Join workspace using invitation link (#382)

* update the workspace method for confirmationlink

* update the confirmmembership function of workspace

* comments added

* lints removed

* Bump version up to 1.0.7

* Bump version up to 1.0.8

* Bump version up to 1.0.9

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>

Co-authored-by: Taly <vitalik7tv@yandex.ru>
Co-authored-by: Mikhail Popov <geekan@bk.ru>
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: Ilya Moroz <37909603+ilyamore88@users.noreply.github.com>
Co-authored-by: Nikita Melnikov <nikmel2803@gmail.com>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Umang G. Patel <23169768+robonetphy@users.noreply.github.com>
  • Loading branch information
10 people authored Feb 15, 2022
1 parent 2780629 commit c4845b0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawk.api",
"version": "1.0.8",
"version": "1.0.9",
"main": "index.ts",
"license": "UNLICENSED",
"scripts": {
Expand Down
46 changes: 19 additions & 27 deletions src/models/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,41 +230,33 @@ export default class WorkspaceModel extends AbstractModel<WorkspaceDBScheme> imp
*
* @param member - member for whom confirm membership
*/
public async confirmMembership(member: UserModel): Promise<boolean> {
const { matchedCount, modifiedCount } = await this.collection.updateOne(
{
userId: new ObjectId(member._id.toString()),
},
{ $unset: { isPending: '' } }
);

const isUserAlreadyConfirmedInvitation = matchedCount > 0 && modifiedCount === 0;
public async confirmMembership(member: UserModel): Promise<void> {
/**
* Check if user is already a member of workspace or not.
*/
const isUserAlreadyConfirmedInvitation = await this.teamCollection.findOne({
userId: new ObjectId(member._id.toString()),
});

if (isUserAlreadyConfirmedInvitation) {
throw new Error('User is already confirmed the invitation');
}

/**
* In case user was invited via email instead of invite link
* If user is not member of workspace
* then edit team collection.
*/
if (matchedCount === 0) {
await this.collection.updateOne(
{
userEmail: member.email,
await this.teamCollection.updateOne(
{
userEmail: member.email,
},
{
$set: { userId: new ObjectId(member._id.toString()) },
$unset: {
userEmail: '',
},
{
$set: { userId: new ObjectId(member._id.toString()) },
$unset: {
userEmail: '',
isPending: '',
},
}
);

return false;
}

return true;
}
);
}

/**
Expand Down
9 changes: 2 additions & 7 deletions src/resolvers/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,8 @@ module.exports = {
throw new ApolloError('The link is broken');
}

const membershipExists = await workspace.confirmMembership(currentUser);

if (membershipExists) {
await currentUser.confirmMembership(workspaceId);
} else {
await currentUser.addWorkspace(workspaceId);
}
await workspace.confirmMembership(currentUser);
await currentUser.addWorkspace(workspaceId);

return {
recordId: workspace._id.toString(),
Expand Down

0 comments on commit c4845b0

Please sign in to comment.