Code Monkey home page Code Monkey logo

Comments (5)

gocandra avatar gocandra commented on May 24, 2024 1

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.

gocandra avatar gocandra commented on May 24, 2024 1

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.

harvic3 avatar harvic3 commented on May 24, 2024

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.

harvic3 avatar harvic3 commented on May 24, 2024

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.

harvic3 avatar harvic3 commented on May 24, 2024

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 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.