Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate v3 programming model to v4 related with PR - #174 #231

Merged

Conversation

glaucia86
Copy link
Contributor

@glaucia86 glaucia86 commented Jul 4, 2023

Hi, folks.

This issue is related with #174.

cc: @manekinekko @anfibiacreativa

@glaucia86 glaucia86 marked this pull request as draft July 4, 2023 21:43
@glaucia86 glaucia86 changed the title Migrate v3 programming model to v4 related with #174] Migrate v3 programming model to v4 related with #174 Jul 4, 2023
@glaucia86 glaucia86 changed the title Migrate v3 programming model to v4 related with #174 Migrate v3 programming model to v4 related with PR - #174 Jul 4, 2023
@glaucia86 glaucia86 marked this pull request as ready for review July 5, 2023 23:08
@glaucia86 glaucia86 marked this pull request as draft July 5, 2023 23:10
@glaucia86
Copy link
Contributor Author

@glaucia86 did you commit these changes to this PR? I don't see the new commit 😅

@manekinekko now is finally done!

infra/core/database/postgresql/flexibleserver.bicep Outdated Show resolved Hide resolved
infra/main.bicep Show resolved Hide resolved
packages/portal/package.json Outdated Show resolved Hide resolved
scripts/database/restore.sh Outdated Show resolved Hide resolved
@manekinekko
Copy link
Collaborator

@glaucia86 can you also add a readme.md file under packages/api-v4/ explaning how to start the new API? (similarily to packages/api/README.md). Some steps are necessary for the new API to execute, for instance renaming local.settings.sample.json to local.settings.json, etc...

packages/api-v4/README.md Outdated Show resolved Hide resolved
packages/api-v4/README.md Outdated Show resolved Hide resolved
packages/api-v4/README.md Show resolved Hide resolved
packages/api-v4/README.md Outdated Show resolved Hide resolved
infra/core/database/postgresql/flexibleserver.bicep Outdated Show resolved Hide resolved
@glaucia86
Copy link
Contributor Author

@manekinekko I made the changes as asked. Thanks a lot :)

@gabrieljoelc
Copy link

gabrieljoelc commented Sep 29, 2023

great PR and related blog post!

I have a question and one feedback:

  • Question: how did you generate the openapi.yml file?
  • Feedback: I wonder if it would have been easier to understand the v3 to v4 differences if the formatting changes were included in a separate PR

import { postCheckout } from "./functions/checkout";

//#region User Function
app.get("get-users", {

Choose a reason for hiding this comment

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

I love this index.ts file aggregating the bindings from the functions. It loosens the coupling between the endpoints and the Azure Function infrastructure a bit.

It also makes it easier to see the possibility of generating functions or bindings based on convention. I've always wished we could Railsify the creation of Azure Functions.

@glaucia86
Copy link
Contributor Author

  • Question: how did you generate the openapi.yml file?
  • Feedback: I wonder if it would have been easier to understand the v3 to v4 differences if the formatting changes were included in a separate PR

Hi, @gabrieljoelc. How are you?

Unfortunately, it was a feature that should have been delivered as soon as possible due to the recent release. However, if you'd like to know more details about how a particular function was implemented, you can check out this blog I wrote with a step-by-step guide: HERE

About the openapi.yaml file, it was created by @manekinekko, and he would be better equipped to provide a response than I am.

@anfibiacreativa anfibiacreativa merged commit e88a755 into Azure-Samples:main Oct 18, 2023
devin-ai-integration bot pushed a commit to altsang/contoso-real-estate that referenced this pull request May 14, 2024
Azure-Samples#231)

* feat(api-v4): initial commit with v4 programming model httpTriggerTest.ts

* fix(api-v4): removing unecessary console.log

* chore(api-v4): install new dependecies and devdependecies

* chore(api-v4): development of the 'User' schema

* refactor(api-v4): create 'User' interface

* fix(api-v4): fixing import file path

* fix(api-v4): fixing import file path

* chore(api-v4): initialize the getUser.ts development

* fix(api-v4): fix typo

* chore(api-v4): include schema templates

* chore(api-v4): modified 'tsconfig.json' file config

* chore(api-v4): install new packages (applicationinsights, winston and winston-transport)

* fix(api-v4): remove unecessary comments

* chore(api-v4): dcreate interfaces in 'appConfig.ts'

* chore(api-v4): development of mongoose configuration - WIP

* chore(api-v4): development of the 'observability.ts'services - WIP

* chore(api-v4): development of the Winston Transports and App Insights config - WIP

* fix(api-v4): remove unecessary file

* refactor(api-v4): using type inferece to refactor the file

* chore(api-v4): changing the typescript version

* chore(api-v4): development of the 'applicationInsightsTransports'

* fix(api-v4): typo

* fix(api-v4): renaming the function from 'getUsers' to 'users'

* chore(api-v4): migrating 'get-users'(v3) to 'users' (v4) functions

* chore(api-v4): migrating 'get-user-by-id'(v3) to 'user' (v4) functions

* chore(api-v4): development of the 'observability' file

* chore(api-v4): finish development of the 'mongoose.ts' file

* chore(api-v4): install packages: pg,azure-key-vault, aad

* chore(api-v4): development of the postgres database configuration

* chore(api-v4): development of the 'index.ts' file from 'config' folder

* chore(api-v4): including the '.env_example' and 'openapi.yaml' files

* chore(api-v4): development of the 'payment.schema.ts' file

* chore(api-v4): development of the 'payment.ts' file

* fix(api-v4): modify method name

* fix(api-v4): style typo

* chore(api-v4): migration from v3 to v4 from: 'get-payment-by-id' function

* chore(api-v4): add 'toUpperCase for get secret names

* chore(api-v4): rename the function's name

* chore(api-v4): create new files for refactor

* chore(api-v4): development of middleware for api-v4

* refactor(api-v4): refactoring the new api-v4

* fix(api-v4): some important changes

* chore(api-v4): include TODO for 'initializeDatabaseConfiguration' method

* chore(api-v4): development of the get-payments function

* chore(api-v4): development of the get-payments function

* chore(api-v4): include 'local.settings.sample.json' and removed 'NOTES.md' file from .gitignore

* chore(api-v4): development of the 'reservation.schema.ts' file

* refactor(api-v4): applied refactor in the 'updatePaymentStatus' method

* chore(api-v4): development of the 'reservation.ts' file

* chore(api-v4): development of the 'reservation-request.ts' file

* chore(api-v4): development of the models: 'favorite' and 'listing'

* chore(api-v4): include ObjectId from mongoose in the 'getListingById' method

* chore(api-v4): development of the 'get-reservation-by-id' function from v3 to v4

* fix(api-v4): fix typo

* chore(api-v4): development of the 'get-reservation' function from v3 to v4

* fix(api-v4): fix typo

* chore(api-v4): include a typescript flag in the 'start' script cmd

* chore(api-v4): development of the 'get-favorites' function from v3 to v4

* chore(api-v4): changing the tsconfig.json according from the 'api'

* chore(api-v4): change the 'routePrefix'

* chore(api-v4): update 'local.settings.sample.json' file

* chore(api-v4): removing header

* chore(api-v4): development of the 'get-listing-by-id' function from v3 to v4

* chore(api-v4): development of the 'get-listing' function from v3 to v4

* chore(api-v4): development of the 'openapi' function from v3 to v4

* chore(api-v4): returning with interfaces

* chore(api-v4): development of the 'post-user' function from v3 to v4

* chore(api-v4): development of the 'post-payment' function from v3 to v4

* refactor(api-v4): create 'isValidPayment' to refactor 'postPayment' function

* chore(api-v4): development of the 'post-favorite' function from v3 to v4

* fix(api-v4): return with interfaces in reservation

* chore(api-v4): development of the 'checkout' function from v3 to v4

* chore(api-v4): include the same pattern for error messages

* chore(api-v4): development of the 'delete-favorite' function from v3 to v4

* refactor(api-v4): return with interfaces - Favorite

* chore(api-v4): development of the 'patch-reservation-by-id' function from v3 to v4

* fix(api-v4): returning with interfaces 'Payment'

* chore(api-v4): including a pattern for error messages

* chore(api-v4): removing unecessary file and function

* chore(api-v4): remove header and unecessary file

* fix(api-v4): change from 'console' to 'context'

* refactor(api-v4): include a type 'DeleteFavoriteRequestBody'

* refactor(api-v4): include try-catch block

* chore(api-v4): including packages according to the 'api'

* fix(api-v4): rename the '.env.template' file

* fix(api-v4): rename the file

* fix(api-v4): changes in the '.gitignore' file

* chore(api-v4): added some new config to be ignored in the application

* fix(api-v4): remove unecessary ignored config

* fix(api-v4): change 'routePrefix'

* fix(api-v4): update '@azure/functions' package

* fix(api-v4): removed the conversion

* chore(api-v4): add comment

* chore: include the 'api-v4' in the main package.json file

* chore: update the 'package-lock.json' file

* chore: important update in the 'applicationinsights' package

* chore: include double quotes

* chore: include the application insights transport importation

* chore: update the 'local.settings.json' file

* feat(api-v4): initial commit with v4 programming model httpTriggerTest.ts

* fix(api-v4): removing unecessary console.log

* fix(api-v4): removing unecessary console.log

* chore(api-v4): install new dependecies and devdependecies

* chore(api-v4): development of the 'User' schema

* refactor(api-v4): create 'User' interface

* fix(api-v4): fixing import file path

* fix(api-v4): fixing import file path

* chore(api-v4): initialize the getUser.ts development

* fix(api-v4): fix typo

* chore(api-v4): include schema templates

* chore(api-v4): modified 'tsconfig.json' file config

* chore(api-v4): install new packages (applicationinsights, winston and winston-transport)

* fix(api-v4): remove unecessary comments

* chore(api-v4): dcreate interfaces in 'appConfig.ts'

* chore(api-v4): development of mongoose configuration - WIP

* chore(api-v4): development of the 'observability.ts'services - WIP

* chore(api-v4): development of the Winston Transports and App Insights config - WIP

* fix(api-v4): remove unecessary file

* refactor(api-v4): using type inferece to refactor the file

* chore(api-v4): changing the typescript version

* chore(api-v4): development of the 'applicationInsightsTransports'

* fix(api-v4): typo

* fix(api-v4): renaming the function from 'getUsers' to 'users'

* chore(api-v4): migrating 'get-users'(v3) to 'users' (v4) functions

* chore(api-v4): migrating 'get-user-by-id'(v3) to 'user' (v4) functions

* chore(api-v4): development of the 'observability' file

* chore(api-v4): finish development of the 'mongoose.ts' file

* chore(api-v4): install packages: pg,azure-key-vault, aad

* chore(api-v4): development of the postgres database configuration

* chore(api-v4): development of the 'index.ts' file from 'config' folder

* chore(api-v4): including the '.env_example' and 'openapi.yaml' files

* chore(api-v4): development of the 'payment.schema.ts' file

* chore(api-v4): development of the 'payment.ts' file

* fix(api-v4): modify method name

* fix(api-v4): style typo

* chore(api-v4): migration from v3 to v4 from: 'get-payment-by-id' function

* chore(api-v4): add 'toUpperCase for get secret names

* chore(api-v4): rename the function's name

* chore(api-v4): create new files for refactor

* chore(api-v4): development of middleware for api-v4

* refactor(api-v4): refactoring the new api-v4

* fix(api-v4): some important changes

* chore(api-v4): include TODO for 'initializeDatabaseConfiguration' method

* chore(api-v4): development of the get-payments function

* chore(api-v4): development of the get-payments function

* chore(api-v4): include 'local.settings.sample.json' and removed 'NOTES.md' file from .gitignore

* chore(api-v4): development of the 'reservation.schema.ts' file

* refactor(api-v4): applied refactor in the 'updatePaymentStatus' method

* chore(api-v4): development of the 'reservation.ts' file

* chore(api-v4): development of the 'reservation-request.ts' file

* chore(api-v4): development of the models: 'favorite' and 'listing'

* chore(api-v4): include ObjectId from mongoose in the 'getListingById' method

* chore(api-v4): development of the 'get-reservation-by-id' function from v3 to v4

* fix(api-v4): fix typo

* chore(api-v4): development of the 'get-reservation' function from v3 to v4

* fix(api-v4): fix typo

* chore(api-v4): include a typescript flag in the 'start' script cmd

* chore(api-v4): development of the 'get-favorites' function from v3 to v4

* chore(api-v4): changing the tsconfig.json according from the 'api'

* chore(api-v4): change the 'routePrefix'

* chore(api-v4): update 'local.settings.sample.json' file

* chore(api-v4): removing header

* chore(api-v4): development of the 'get-listing-by-id' function from v3 to v4

* chore(api-v4): development of the 'get-listing' function from v3 to v4

* chore(api-v4): development of the 'openapi' function from v3 to v4

* chore(api-v4): returning with interfaces

* chore(api-v4): development of the 'post-user' function from v3 to v4

* chore(api-v4): development of the 'post-payment' function from v3 to v4

* refactor(api-v4): create 'isValidPayment' to refactor 'postPayment' function

* chore(api-v4): development of the 'post-favorite' function from v3 to v4

* fix(api-v4): return with interfaces in reservation

* chore(api-v4): development of the 'checkout' function from v3 to v4

* chore(api-v4): include the same pattern for error messages

* chore(api-v4): development of the 'delete-favorite' function from v3 to v4

* refactor(api-v4): return with interfaces - Favorite

* chore(api-v4): development of the 'patch-reservation-by-id' function from v3 to v4

* fix(api-v4): returning with interfaces 'Payment'

* chore(api-v4): including a pattern for error messages

* chore(api-v4): removing unecessary file and function

* chore(api-v4): remove header and unecessary file

* fix(api-v4): change from 'console' to 'context'

* refactor(api-v4): include a type 'DeleteFavoriteRequestBody'

* refactor(api-v4): include try-catch block

* chore(api-v4): including packages according to the 'api'

* fix(api-v4): rename the '.env.template' file

* fix(api-v4): rename the file

* fix(api-v4): changes in the '.gitignore' file

* chore(api-v4): added some new config to be ignored in the application

* fix(api-v4): remove unecessary ignored config

* fix(api-v4): change 'routePrefix'

* fix(api-v4): update '@azure/functions' package

* fix(api-v4): removed the conversion

* chore(api-v4): add comment

* chore: include the 'api-v4' in the main package.json file

* chore: update the 'package-lock.json' file

* chore: important update in the 'applicationinsights' package

* chore: include double quotes

* chore: include the application insights transport importation

* chore: update the 'local.settings.json' file

* chore: include '@apollo/client' package

* fix: follow up the code review

* chore: install 'apollo/client'

* Update flexibleserver.bicep

fix: following up code review

* Update main.bicep

fix: following up the code review

* fix: remove unecessary space

* fix: following up the code review

* docs: include README.md file under api-v4 folder

* docs: update the README.md under api-v4 folder

* fix: following up the code review

* chore: running npm i command

* chore: update '@azure/functions' and '@ApplicationInsights' packages for release v4

* chore: execute 'npm run format' command

* docs: include the README.md according from the main branch

---------

Co-authored-by: Julien Dubois <julien.dubois@gmail.com>
Co-authored-by: Natalia Venditto <nataliafrontend@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants