Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

feat: create code snippets for api (#342) - #396

Open
kacper-cyra wants to merge 22 commits into
mainfrom
issue-342-Create_code_snippets_for_api
Open

feat: create code snippets for api (#342)#396
kacper-cyra wants to merge 22 commits into
mainfrom
issue-342-Create_code_snippets_for_api

Conversation

@kacper-cyra

Copy link
Copy Markdown
Contributor

Closes#342

@vercel

vercelBot commented Oct 18, 2021

Copy link
Copy Markdown

@KonradSzwarc
KonradSzwarc temporarily deployed to coderscamp-issue-342-cr-glpvf9 October 18, 2021 18:03 Inactive
@codecov-commenter

codecov-commenter commented Oct 18, 2021

Copy link
Copy Markdown

Codecov Report

Merging #396 (d8c2bf2) into main (23a9f2c) will increase coverage by 0.04%.
The diff coverage is n/a.

❗ Current head d8c2bf2 differs from pull request most recent head dafd9a4. Consider uploading reports for the commit dafd9a4 to get more accurate results
Impacted file tree graph

@@ Coverage Diff @@## main #396 +/- ##
==========================================
+ Coverage 87.87% 87.92% +0.04% 
==========================================
Files 150 151 +1 Lines 1806 1830 +24 Branches 236 243 +7 ==========================================
+ Hits 1587 1609 +22 - Misses 218 220 +2 
Partials 1 1 
FlagCoverage Δ
api85.60% <ø> (ø)
ui98.48% <ø> (-0.54%)⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted FilesCoverage Δ
...ckages/ui/src/components/EventsCard/EventsCard.tsx91.66% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23a9f2c...dafd9a4. Read the comment docs.

@MateuszNaKodach

Copy link
Copy Markdown
Member

@kacper-cyra Could you write in README or docs how to use it :) ?

Comment threadtemplates/domain-function/domain-function.hbs Outdated
Comment threadtemplates/command/command.hbs Outdated
Comment threadtemplates/domain-function/domain-function.hbs Outdated
Comment on lines +27 to +28
(pastEvents) => {{camelCase domainFunction}}(pastEvents, command),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you change snippet like I suggested below, then you can change that snippet to this:

Suggested change
(pastEvents) => {{camelCasedomainFunction}}(pastEvents, command),
);
{{camelCasedomainFunction}}(command),
);

@hkawalekhkawalekOct 25, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe, we can go even further and change applicationService.execute interface to sth like this.

this.applicationService.execute<{{properCase event}}>(
eventStream,
command,
{{camelCasedomainFunction}},
);

Then inside execute we can map command to metadata and we don't need extra currying of domainFunction as proposed by @KrystianKjjk .
What do you think @nowakprojects ?

@KrystianKjjk

Copy link
Copy Markdown
Contributor

It will be good to add automationModule generator which add this 4 required files ;)

@hkawalekhkawalek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall it looks good (it's cross-platform and it uses CLI, so it meets our requirements). If I were you, I would add some tests to give some kind of documentation, and what is more important, to protect from bugs if someone would like to change or add a new template. I would recommend you to use snapshot-testing and tmp.dir for that.

Comment threadtemplates/module/generator.ts Outdated
Comment threadtemplates/utils/runActionConditionally.ts Outdated
Comment threadtemplates/utils/runActionConditionally.ts
Comment on lines +27 to +28
(pastEvents) => {{camelCase domainFunction}}(pastEvents, command),
);

@hkawalekhkawalekOct 25, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe, we can go even further and change applicationService.execute interface to sth like this.

this.applicationService.execute<{{properCase event}}>(
eventStream,
command,
{{camelCasedomainFunction}},
);

Then inside execute we can map command to metadata and we don't need extra currying of domainFunction as proposed by @KrystianKjjk .
What do you think @nowakprojects ?

@MateuszNaKodachMateuszNaKodach 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.

Looks very good for me :)
Big thank you for initiative and implementation.
We can introduce change proposed by @HTK4 in ApplicationService. Of course it could be done in another task.
Snapshot testing for that would be awesome!

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create code snippets for api

6 participants

@kacper-cyra@codecov-commenter@MateuszNaKodach@KrystianKjjk@hkawalek@KonradSzwarc