Giter VIP home page Giter VIP logo

auctions-api-csharp's People

Contributors

wallymathieu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

auctions-api-csharp's Issues

SqlLite migrations

We get the following error when trying to migrate the DB using SqlLite as the database:

SQLite Error 1: 'AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY'.

CDN

It is not uncommon to want to use CDN for static or relatively static content.

Add Authorize Attributes

The test authorization should register as an authorization scheme in order for standard API behaviour to work.

Database schema should be adjusted

CREATE TABLE [dbo].[Auctions](
	[AuctionId] [bigint] IDENTITY(1,1) NOT NULL,
	[Options_ReservePrice] [bigint] NOT NULL,
	[Options_MinRaise] [bigint] NOT NULL,
	[Options_TimeFrame] [time](7) NOT NULL,
	[EndsAt] [datetimeoffset](7) NULL,
	[StartsAt] [datetimeoffset](7) NOT NULL,
	[Title] [nvarchar](200) NOT NULL,
	[Expiry] [datetimeoffset](7) NOT NULL,
	[User] [nvarchar](2000) NOT NULL,
	[Currency] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Auctions] ADD  CONSTRAINT [PK_Auctions] PRIMARY KEY CLUSTERED 
(
	[AuctionId] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Bids](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[User] [nvarchar](2000) NOT NULL,
	[Amount_Value] [bigint] NOT NULL,
	[Amount_Currency] [int] NOT NULL,
	[At] [datetimeoffset](7) NOT NULL,
	[TimedAscendingAuctionAuctionId] [bigint] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Bids] ADD  CONSTRAINT [PK_Bids] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Bids_TimedAscendingAuctionAuctionId] ON [dbo].[Bids]
(
	[TimedAscendingAuctionAuctionId] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, DROP_EXISTING = OFF, ONLINE = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Bids]  WITH CHECK ADD  CONSTRAINT [FK_Bids_Auctions_TimedAscendingAuctionAuctionId] FOREIGN KEY([TimedAscendingAuctionAuctionId])
REFERENCES [dbo].[Auctions] ([AuctionId])
GO
ALTER TABLE [dbo].[Bids] CHECK CONSTRAINT [FK_Bids_Auctions_TimedAscendingAuctionAuctionId]
GO

NOTE:
TimedAscendingAuctionAuctionId should be AuctionId

[Amount_Currency] [int] NOT NULL, should be nvarchar.

Azure functions docker does not work on arm

2023-05-01 16:57:27        ---> Microsoft.Azure.WebJobs.Script.Workers.WorkerProcessExitException: dotnet exited with code 133 (0x85)
2023-05-01 16:57:27        ---> System.Exception: assertion failed [result.value != EEXIST]: VmTracker attempted to allocate existing mapping

See docker/roadmap#384

Apply clean code based architecture

Hexagonal architecture is a common architecture pattern. For line of business application, matching a common pattern can helpful since it allows you use something a bit more standard.

Identity provider

In order to allow users to connect to the API you need an identity provider that can handle authentication and serve up user information to the API. Sample identity providers are:

and many others. It would be preferable to have a situation where you can have a pluggable identity provider that you use in PROD.

In order to have easy time developing the API you need to make it easy for the developers to do DEV-authenticated requests.

Potential solutions:

  • Impersonification: either by having JWT token generator or part of the identity provider
  • Dev only API keys (often frowned upon)
  • "Principal" header as seen with x-ms-client-principal.
  • Payload part of JWT token in "x-jwt-payload". I've seen decoded JWT tokens in Envoy and NGinx

API test for when there is no auction

In order to verify that the API returns the correct result when there is no auction, make sure to add tests that verify the default expected behaviour (that the endpoint returns 404 not found).

Test with queue implementation

Right now the tests against the Web API only tests the case of the non "async" style code flow. Since the App is configurable to be able to do both queue based "async" style and "sync" style.

In order to make the API more useful it would make sense to let "async" flow return 202 Accepted with a response id (either a temporary ID or an ID that gets generated immediately in the controller) that can be used to query the API for further status of resource creation/update.

For client applications it would make more sense to use web socket based server sent events since then you can avoid having your own web clients waste your resources by doing something akin to DDOS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.