Typed database classes

So we have had some problems in my team regarding the object api. Since it is hard to use without knowing the exact key names it makes us go to our documentation all the time.

So we have developed a small wrapper which makes it possible to do the following:

user.username.set("new name")
user.level.increment()
user.weapons.addUnique("sword")

It works with pointers and relations as well.

If anyone is interested it is available here, feedback is appreciated.

4 Likes

I love this idea.
In my team, me and @matti1208 approached the same problem with the idea of taking advantage of Injectables in Angular.
What you created was my first idea too, but i was not, at the time, skilled enough to build something decent like yours (my first time moving from C/C++ to frontend Development and the time available was quite little), but also our result was not so bad.
Basically we packed the whole logic withing service classes, who knew how to perform CRUD operations. For the Object used on the frontend, we used the classic models written directly as Typescript classes, that would have later been mapped to Parse:object by the services.

After writing a basic service covering most of the needed functions, we’d only need to extend it with a new service class and forget completely about the Parse SDK.

Ofc, the basic service we created would not cover all the functions that could be performed with the SDK, but for newbies that joined the project later would be a not traumatizing at all experience: did not have to learn how to use the SDK, no need for having to touch javascript at all…

Hopefully we’ll have the time to complete it and share it too

1 Like

Thanks for the feedback @Sbef98 ! Glad to hear you liked it. It made me add some new features including properly typed cloud functions.

1 Like

The package has been updated with parse-sdk-js as a peer dependency for version agnostic usage. It is also even more type safe now!

1 Like

Well done! Thank you for your contribution. I will try

2 Likes

Please tell if there are any problems using it or getting it to work :slight_smile:

1 Like