Skip to content

Feat 129 update mentor tags#133

Merged
yellalena merged 5 commits into
developfrom
feat-129-update-mentor-tags
Nov 1, 2025
Merged

Feat 129 update mentor tags#133
yellalena merged 5 commits into
developfrom
feat-129-update-mentor-tags

Conversation

@marinacatbytes

Copy link
Copy Markdown
Contributor

This PR covers the following:

  • creates new functions for tags in tags_repository
  • updates PUT and POST /mentors/:id flow to accept tags
  • creates new function in to update mentor tags
  • updates mentor_service tests

@yellalena yellalena linked an issue Oct 21, 2025 that may be closed by this pull request

@yellalena yellalena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great work, here's the first round of review - I'd take another thorough look after the changes are made 😊

Comment thread repositories/mentor_repository.js
Comment thread repositories/mentor_repository.js Outdated
Comment thread repositories/mentor_repository.js Outdated
Comment thread repositories/mentor_repository.js Outdated
Comment thread repositories/mentor_repository.js Outdated
Comment thread repositories/tags_repository.js Outdated
Comment thread repositories/tags_repository.js Outdated
.first();
}

async function createTag(name, trx) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great job preparing our service to use transactions 👏

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks Aliona, but I think I have to remove it for now, since I can't pass the trx from service level for now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because then i will have to import knex in service level, which I think is not in line with architecture.
am I missing something? :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that's not a problem, the problem is nesting repository calls which makes the code a bit harder to navigate and can cause potential import problems.
as we're trying to separate concerns, we agreed to keep all data aggregation on service layer, leaving repositories with operations they're responsible for only.
however, this doesn't mean we can't import knex anywhere else, the opposite even: the idea of transactions is to keep the whole operation atomic, which by definition means the transaction is supposed to be started on the service level and then passed to all repos.

sometimes it is suggested to have a separate layer for transactions, for example a repo registry, but I feel this is going to be a bit of overengineering in our case. but in general the idea is that the transactions are in very rare cases actually initialized inside of database layer.

but that's ok, in general migrating to transactions would be a rather big piece of work and maybe is worth doing it in a separate PR. so if you don't want to have it here, it's fine

Comment thread services/mentor_service.js Outdated
@yellalena yellalena merged commit df73e4c into develop Nov 1, 2025
2 checks passed
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.

Tags: update mentor enpoint

3 participants