I've created repo for this here - https://github.com/meetzaveri/hasura-seeds-automation-script
Script I used to extract tables from psql
This is to extract all tables from public
schema into output file of temp.txt
postgres=> \o temp.txt
I've created repo for this here - https://github.com/meetzaveri/hasura-seeds-automation-script
Script I used to extract tables from psql
This is to extract all tables from public
schema into output file of temp.txt
postgres=> \o temp.txt
The OpenAPI 3 specification of the REST endpoints are exposed at /api/swagger/json
for admin role only. We want that API to be exposed to different roles too. So different roles will be able to access different schemas (as per the permission level defined in hasura).
Let me explain this with an example:
For eg., I have a book
table and an author
table. And I make a mutation to insert a book, and create a RESTified endpoint from it (as an admin).
I create a role named "editor". This editor role may have permissions to run the mutation to insert a book, but nothing else. But the admin role will be able to insert the book, and also the author through the relationship.
Attaching docs here for reference - https://hasura.io/docs/latest/api-reference/restified/#openapi-3-specification
useEffect(() => { | |
// define increment counter part | |
const tabsOpen = localStorage.getItem('tabsOpen') | |
console.log('tabsOpen', tabsOpen) | |
if (tabsOpen == null) { | |
localStorage.setItem('tabsOpen', 1) | |
} else { | |
localStorage.setItem('tabsOpen', parseInt(tabsOpen) + parseInt(1)) | |
} |
const { useRef, useEffect } = require('react')
const useLoadMoreOnScroll = (count, data, nextPage, fetch = () => null) => {
const hasMore = count > data?.length
const root = useRef()
const isLoadingMore = useRef(false)
useEffect(()=>{
import React, { useEffect } from 'react'; | |
const ProfileContainer = () => { | |
// generally I prefer this as useEffect with empty args[] | |
useEffect(() => { | |
fetch('/api/user') // perform any side effects or network requests | |
// you can have return() for this function which will be executed once component will unmount |
import React, { useEffect } from 'react'; | |
import ProfilePage from './ProfilePage'; | |
const ProfileContainer = () => { | |
useEffect(() => { | |
fetch('/api/user') // perform any side effects or network requests | |
}, []); // <-- empty array means 'run once' | |
return <ProfilePage />; |
import React, { useEffect } from 'react'; | |
const Container = () => { | |
const userInfo = props.userInfo; | |
const makeAPICall = () => { | |
// do your async actions, side effects or network effects | |
} | |
useEffect(makeAPICall,[userInfo]) | |
return (<div>Example</div>); |
To get timestamp
dayjs().valueOf()
// 1598941800000
// OR
dayjs(`${selectedTime.year}-${selectedTime.month}-${dateValue}`).valueOf()
// 1598941800000
Code
console.log('endValue', value) // 03:25
const { currentTimeStamp } = this.state
const generateTimeInMs = value + ':00'
let dateTemplate = moment(currentTimeStamp).format('DD MMM YY')
const newTimeStamp = Date.parse(dateTemplate + ' ' + generateTimeInMs)
In package.json
"build": "yarn build:css && CI= react-scripts build",