Comments (5)
I've just solved it... ajjajajjaajaja sry to bother
just for anyone else looking for this, you declare result like so.
const result = new ResultT()
from nodetskeleton.
thanks! yeah, everything just fell into place afterwards. I was struggling at first with incorporating the whole framework into my head, but I fell that I'm now able to extract the most value out of this template. This is a very nice project, congrats!!
from nodetskeleton.
Hi @gocandra result can be use with type ResultT (IResultT) o without type Result (IResult)
With type
const result = new ResultT<YourType>();
Without type
const result = new Result();
I hope this gives you more clarity about the use of this package.
from nodetskeleton.
I have the following problem using ResultT
`import { BaseUseCase, IResultT, ResultT } from "./base/BaseUseCase"
import { IPatientRepository, IPatient } from "@umahealth/repositories-module"export class FindPatientUseCase extends BaseUseCase {
constructor(private readonly PatientRepository: IPatientRepository) {
super()
}
async execute(uid: string, patient: IPatient): Promise {
const result = new ResultT()
const patientExists: IPatient = await this.PatientRepository.getByUid(uid)
result.setData(patientExists, 200)
return result
}
}`it says
Type 'Result<unknown>' is not assignable to type 'IResult<IPatient>'. Types of property 'data' are incompatible. Type 'unknown' is not assignable to type 'string | IPatient'. Type 'unknown' is not assignable to type 'IPatient'
I'm failling to understand how to properly use this library. Could you please give me some guidance?
@gocandra in this line, you can use the statusCode using Clean Code:
result.setData(patientExists, this.applicationStatus.SUCCESS,)
If you need create more aplication status codes, so you can map this status codes into the file StatusMapping in path:
src/adapters/controllers/base/httpResponse/
from nodetskeleton.
Thanks @gocandra, but don't forget to leave your star. It's a way to move the project forward and a form of support. ^^
from nodetskeleton.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodetskeleton.