Typescript: how do I make a generic function to validate incoming POST requests if each request will have a different body?

I want to make a generic validateRequest() function for my web server that will take in any incoming request and check some things to make sure everything is good. The problem is that each request could have a potentially different body. The way I have it set up right now is that it works to validate 1 type of request, but that's because I passed in the exact model of the request in the function's parms.

validateRequest(req: Request<object, object, RequestModel1>, someOtherParm: number): [number, string] {}

Each of the different possible bodys of a valid request will share one field - I need to be able to validate the value in this field, regardless of the shape of the body of the incoming request. I also am very security-conscious, so I want to make sure whatever solution I end up with here won't put me at risk of accepting an incoming request that is bogus or malicious. How would I modify my function to handle this?

reddit.com
u/Reasonable-Job4205 — 11 days ago

What is recommended for this situation about where to write code?

I made a textfield run a bunch of code on submitted. I now want to fire that same code on a different event (a button press). Should I

  1. Move the code to a function outside of the widget's `build` but within the state class that can then be reused

  2. Manually call the textfield's on submitted event to rerun that same code

As I write this, I think the answer is a 3rd option: move the vode to a function, but place this function within the widget's build function. Dang, have I been making a mistake putting my custom functions just outside the widget's build function?? Because if you put it within, you can use the widget context directly

reddit.com
u/Reasonable-Job4205 — 13 days ago

How do I make a table of contents on the first page of my Word doc?

I want to have a bunch of links to other sections of the same word doc on the first page. How do I do this?

reddit.com
u/Reasonable-Job4205 — 21 days ago
▲ 81 r/autism

Is it possible for autism to get worse with age?

I'm noticing that I have less enthusiasm when talking to people and its making me worse with social cues and timing. I wasnt like this when I was younger and it seems to be getting worse with age. Does it get worse later on like when I'm old?

reddit.com
u/Reasonable-Job4205 — 2 months ago

I dont know what to do

My whole life I've lived with the mentality of sacrificing for my family. And I'm just now realizing that they're never going to give me the love that I've wanted for 20 years. Since high school, I've been looking out for my family and always trying to sacrifice my own happiness for them. But recently I realized that...they don't care. They are hyper individualist and I'm not. I wanted to feel like I have a family with my real family. I've told them this over the years, but they dont seem to feel the same way that I feel. The realization of this is breaking me. My own family doesnt care that I'm suffering. They just call me dramatic.

I don't know what to do with my life anymore. It feels like theres no point anymore.

reddit.com
u/Reasonable-Job4205 — 2 months ago

[Request] How large of a machine would you need to pump comfortably breathable air into a sealed helmet (with some kind of exhaust pipe for exhales, ofc) for an adult human?

Oxygen masks are great, but they only give you oxygen via a mask you have to press to your face. Imagine instead something like an astronauts space suit or the suit that Sandy Cheeks wears in spongebob

reddit.com
u/Reasonable-Job4205 — 2 months ago

How much prefix adding do you do to your objects in SSMS? Is it still important?

I am naming all my stored procedures as "spActualSPName". I got into this habit because of working with a SQL database that used MS Access as the front end, so it was helpful to know that the thing I was looking at in VBA was an SP. Is prefixing still needed? Do you do this?

reddit.com
u/Reasonable-Job4205 — 2 months ago

Real estate agent wants me to sign something that says that I would pay them a commission if the seller/seller's brokerage doesn't offer them compensation to the buyer's broker

Is this normal? Contract would only last 2 days. This is for an agent I found through zillow. He said it's most likely the case that the seller will pay, but this means I cover them if they don't. Is this normal or am I getting scammed here? He also said it was based on some 2024 law that passed in Illinois in real estate

reddit.com
u/Reasonable-Job4205 — 2 months ago

[Request] How much electricity could a world class cyclist generate on a stationary bike that generates power while peddling?

Assume:

-athlete is a successful olympic athlete or just world rated at cycling

-stationary bike is whatever brand/model is the best at doing this currently

I need some numbers on what the best cyclists in the world could generate on one of these stationary, electricity generating bicycles

reddit.com
u/Reasonable-Job4205 — 2 months ago

Is there no way to melt the plaque that builds up inside an artery?

I was reading somewhere that it isn't possible to remove the plaque that builds up inside the arteries in the heart. Is this true? Ifnot, then if someone had more plaque than 60% of other people in their age group, what would you recommend them do to get it out?

reddit.com
u/Reasonable-Job4205 — 3 months ago

Is there a way to make a Column widget, but whose children are automatically treated as flex widgets, without me having to wrap each child in Expanded?

I am tired of having to write Expanded for each child of a Column or Row lol

reddit.com
u/Reasonable-Job4205 — 3 months ago

How do I sort my Galaxy S26 Ultra's settings page alphabetically and not grouped?

I can't attach a pic, but my old phone was the same way - the settings page has all the settings grouped by something, but idk rather see a list of settings alphabetically. Is there any way to change it?

reddit.com
u/Reasonable-Job4205 — 3 months ago

Why does the reolink app need my phone's location?

My PoE cameras are working great and so is the app, but I noticed the app was asking for my location - why is this? The phone is connected to the same network that the cameras are, so what bonus does giving it my location grant?

reddit.com
u/Reasonable-Job4205 — 3 months ago
▲ 2 r/llc

When did you first hire a lawyer to make a contract in your business's history?

Did you keep costs low at first and use a free legal template online to make a contract? If so, then as your business grew over the years, when did you eventually get a real lawyer to write a contract? How many years had gone by before you finally upgraded your contracts to a lawyer-written one?

reddit.com
u/Reasonable-Job4205 — 3 months ago

Is UChicago more left or right leaning?

The other day I heard about a certain university being more right leaning than I'd realized, so was curious to know where UChicago falls

reddit.com
u/Reasonable-Job4205 — 3 months ago

For Access, is it still recommended to split your database?

I remember back in the day there was a recommendation to put the data in one Access database and the front end stuff like forms, reports, etc in another and connect them. Is that still the recommended practice?

Also, does Microsoft still do major development for Access or nah? I feel like the last time Access was relevant was like 2005, no? After that, SQL Server took over, then other stuff emerged, etc..

reddit.com
u/Reasonable-Job4205 — 3 months ago

Is there a book out there where the author describes the main character's anxiety in great detail during his journey?

Feeling pretty anxious about a lot of life stuff rn. Was hoping for something where the MC goes on his journey and all that, but with a major point being about dealing with anxiety

Also, while we're at it, recommend me a book in the "outer space sci-fi" genre. Why not

reddit.com
u/Reasonable-Job4205 — 3 months ago
▲ 0 r/llc

Is it normal for an LLC to charge an hourly rate and give an estimate on how many hours, but if completed sooner, the client pockets the savings?

How does an LLC express that they would honor this? What does the marketing look like for this?

reddit.com
u/Reasonable-Job4205 — 3 months ago

Accidentally deleted a stored procedure

I don't have backups of this database. Is there maybe any autologging that could have saved the SP somewhere? Running SQL Express 2022 on my laptop

reddit.com
u/Reasonable-Job4205 — 3 months ago

Why is it that sometimes, when I'm on a user's page on mobile (samsung galaxy), I click on their profile pic and it doesn't full screen?

The fact that sometimes it fullscreens the profile pic and sometimes it doesn't is annoying

reddit.com
u/Reasonable-Job4205 — 3 months ago