Looking for urgent help with API

Bit of a crazy day today. Off now. Will post my integration tests shortly and see if I'm on the right track!
 
@Solarion , not sure what you do with the files after upload, but make sure that you separate the upload from any processing. Processing can take long (depending on what you do) and can easily make the upload request time out. I upload the file to Azure file share or blob storage and then drop a message into an Azure queue. This message gets picked up by a Azure queue-triggered function and then does the processing in the background, free from time limits.

This is what my upload looks like on back-end
View attachment 1441399
The request
View attachment 1441403

And the MediaTR handler

View attachment 1441405
Methods:
View attachment 1441407

AzureFileShareFileStore:
View attachment 1441411

Hmm looking at it now, I might need to dispose/using the stream I get from formFile.OpenReadStream

I have some client code to do the upload. Just need to find it

Interesting. Now I'm curious. Have to experiment with this.

 
Interesting. Now I'm curious. Have to experiment with this.

There are also return types for Maybe<A> . This return type shows that a method returns something of type A or nothing (void)
or
Either<A,B> where a method can return a value of type A or type B.
They are called monads and come from functional programming.
I use Either<> in my integration tests where my HttpClient extension method either returns a deserialized object or it returns the http response content in the case of a non succcessful response. Will post examples later

also look at CSharpFunctionalExtensions nuget.
Result and Result<T>. Allows you return an object T or a failure
 
Interesting. Now I'm curious. Have to experiment with this.


Every mediator query or command we create returns an ErrorOr<T>. This is great because then you must handle both the success and error cases. Far superior to exceptions.

I have used LanguageExt, and it’s Either type, as well as OneOf, but prefer the semantics of ErrorOr for what we wanted - return a result, or return error(s) of some category.

Option/Maybe is also an excellent construct to use that is easy to understand.
 
Every mediator query or command we create returns an ErrorOr<T>. This is great because then you must handle both the success and error cases. Far superior to exceptions.

I have used LanguageExt, and it’s Either type, as well as OneOf, but prefer the semantics of ErrorOr for what we wanted - return a result, or return error(s) of some category.

Option/Maybe is also an excellent construct to use that is easy to understand.

This video is now getting up to this level as I see he uses ErrorOr, Record and a couple of other things I need to get up to speed with <After this festive break of course> but I have one small tiny question. He places in contracts in a separate class. Is there a specific reason for this? The only one I can think of is to perhaps Nuget package this.


 
This video is now getting up to this level as I see he uses ErrorOr, Record and a couple of other things I need to get up to speed with <After this festive break of course> but I have one small tiny question. He places in contracts in a separate class. Is there a specific reason for this? The only one I can think of is to perhaps Nuget package this.



No idea why. People like to have “separation”.
I personally use the commands/queries as the request - but I am not manually creating controllers - all controllers are source generated from the queries/commands, so it makes not sense to have external contracts in my scenario
 
If you want, you can play around with our `dotnet new` template - https://www.nuget.org/packages/RealmDigital.Architecture

You can install it as you would any other template


Bash:
dotnet new install RealmDigital.Architecture

and then you use it like you would any template
Bash:
➜ dotnet new realm-architecture -o [CLIENT.PROJECT_NAME] // replace, including the square brackets, with whatever you want.
The template "The Realm Architecture" was created successfully.
or use the "New Solution" UI in VS or Rider

1672067802832.png

This will give you a full stack working CRUD application, including terraform to provision AWS Fargate based infrastructure.

1672067863281.png

This isn't production ready (from a public consumption of the template - it makes assumptions like Cognito and Planetscale) - but all our projects start with this.

This is basically an evolution of my ideas, seeded by Jimmy Bogard and Jason Taylor.

The goal of all of this is to allow our developers to ship features really quickly, that are end-to-end type-safe, extremely easy to have pretty good tests for, without having to waste time doing the same things over and over again.
In that it has succeeded.

Immediate WIP roadmap is to migrate from Cognito to Auth0, provide an RDS flag for terraform, and switch from JWT auth to BFF/session based auth.
 
Last edited:
@_kabal_ This is hardcore, thanks kabal. I think I'm going to actually just take that break and come back next year. I'm tired and if I start on this I'm going to go down this rabbit hole. This is awesome stuff ty.
 
@_kabal_ This is hardcore, thanks kabal. I think I'm going to actually just take that break and come back next year. I'm tired and if I start on this I'm going to go down this rabbit hole. This is awesome stuff ty.
holidays are for messing around and learning :X3::D

enjoy it though, and have a lekka rest
 
holidays are for messing around and learning :X3::D

enjoy it though, and have a lekka rest

Yah no I'm tapping out for now! Watching that video was the rest of my quota for the year spent lol. You too have a good rest! :giggle:
 
Top
Sign up to the MyBroadband newsletter
X