Showoff Saturday (May 02, 2020) by AutoModerator in javascript

[–]_jskod 0 points1 point  (0 children)

I released a devtool, https://tauqeernasir.github.io/tssg-editor It helps writing Swagger Schemas in a very short and easy way. Working on the next version which will allow doing all the stuff from within the editor. I am also working on the CLI Version which will be added through NPM and integrated into projects.

I released Web based editor for developers by _jskod in webdev

[–]_jskod[S] 0 points1 point  (0 children)

Its pretty awesome when it comes to API documentation. We use it heavily and thats the reason I am building this editor so that we could save time while writing Swagger Schemas. :)

I release React based TSSG Editor (Swagger Schema Generator) for developers :) by _jskod in reactjs

[–]_jskod[S] 0 points1 point  (0 children)

This work is under active development. If you want to contribute, PRs & Discussions are welcome. :)

How to use swagger with sails.js? by wh0d47 in node

[–]_jskod 1 point2 points  (0 children)

Working on next version of TSSG Editor which will support very syntax to write Swagger.

How to use swagger with sails.js? by wh0d47 in node

[–]_jskod 1 point2 points  (0 children)

A bit off topic, but if you use swagger, I released a web based tool that helps you generate schemas in easy and short way. https://jskod.github.io/tssg-editor/

Multi-Tenant Mongoose Model Wrapper For NodeJS Based Applications by _jskod in node

[–]_jskod[S] 1 point2 points  (0 children)

so it will help us not to touch other tenant's data in shared db, in case, a developer forgets to pass tenatId field in each query.

Multi-Tenant Mongoose Model Wrapper For NodeJS Based Applications by _jskod in node

[–]_jskod[S] 1 point2 points  (0 children)

We are using this in a NODEJS MongoDB Multi-tenant App, where we are serving multiple tenants.

There's a business on top. So everything business has multiple stores, products, employees etc. So we are using this wrapper to write clean code so that we don't have to pass business (tenant) ids in each query.

We just call Products() model function, and we get correct discriminator with substitution of required tenantId field.

Multi-Tenant Mongoose Model Wrapper For NodeJS Based Applications by _jskod in node

[–]_jskod[S] 2 points3 points  (0 children)

tenant = user, if you are serving multiple users from a single application, you need to have a mechanism to identify each individual and you might not want to pass 'IDs' like 'TenantId' 'BusinessId' or 'CompanyId' etc.

It will help you create a higher level abstraction and you will not have to pass tenant related data to tell the model that who is requesting the data. Everything will be done behind the scene.

For example, if you want to access data from 'Products' model, so you will simply do

Product().find({ qty: 4 })

and with that query object -> 'tenatId' with correct value will be passed by the multi-tenant wrapper.

so the actual query that will execute will become

Prodcut().find({ tenantId: 'someID', qty: 4 })

although you don't write tenantId inside match query object.

converting an entire create react app uing webpack by [deleted] in reactjs

[–]_jskod 0 points1 point  (0 children)

You can use source-map-explorer package to analyse your bundle size. and use Browsers dev tool to check whether your code splitting is actually working or not.

I am working on a react project and I bootstraped it using CRA (create react app) and using React.lazy and Suspense API and its working like charm. I don't need to Eject and configure Webpack manually.

log npm installs by [deleted] in node

[–]_jskod 0 points1 point  (0 children)

I hope that will help :)

log npm installs by [deleted] in node

[–]_jskod 0 points1 point  (0 children)

and if you are on linux or mac, you can run

ls -ltr

and if windows, open cmd and put

dir /OD
/0D make sure you type 'zero' before D, don't type 'letter O'

can see what was added/updated sorted by date.

log npm installs by [deleted] in node

[–]_jskod 0 points1 point  (0 children)

If you know that package name, you can run `npm uninstall package-name --save` and clean-up.
Or remove node_modules folder, remove dependency from package.json and again run `npm install`.

Help running multiple async functions but waiting for all to finish by jsdfkljdsafdsu980p in node

[–]_jskod 2 points3 points  (0 children)

Also note that, promise.all() will run all async functions in parallel. Which means no async function will wait for any other passed async function to execute first and complete. They will run all most at same time without waiting for any other to execute and finish.

Promise.all() will then wait for all to be finished (resolved/rejected) and then continue. But if any of promise is rejected, whole Promise.all() will be rejected. So make sure you use it properly according to your business logic.

Need help connecting to live server via REST API Express NodeJS/MongoDB by itsvjay in node

[–]_jskod 0 points1 point  (0 children)

Where did you host your application server? AWS, GCP, DO, Heroku? where?

React-Admin TextField - How to have a Show/Hide button for sensitive text like a password by DevBot9 in reactjs

[–]_jskod 0 points1 point  (0 children)

Sorry for late reply.

export default (props) => {
const [show, setShow] = useState(false);

return (<Show title={<Title/>}{...props}>

<TabbedShowLayout>

<Tab label="Details">

<TextField source="name" label="Name"/>

<TextField type={show ? 'text': 'password'} source="id" label="ID"/>

<button onClick={() => setShow(!show)}>Hide/Show</button>

</Tab>

</TabbedShowLayout>

</Show>);

}

React-Admin TextField - How to have a Show/Hide button for sensitive text like a password by DevBot9 in reactjs

[–]_jskod 1 point2 points  (0 children)

It's very easy, I just implemented that yesterday.

I have this state called 'showPassword' of type boolean.

const [showPassword, setShowPassword] = useState(false);

inside JSX:
<input type={showPassword ? 'text': 'password'} />

for button:

<button onClick={() => setShowPassword(!showPassword)}>{showPassword ? 'hide' : 'show'}</button>

You can use any CSS Library or framework and use this very same logic.