0% found this document useful (0 votes)
7 views3 pages

FRs Server Setup and Database Commands

The document provides instructions for setting up a project using Node.js and PostgreSQL, including commands for installing dependencies, starting servers, and managing user roles and permissions. It also includes SQL commands for creating databases, users, and inserting data into tables, as well as commands for using PM2 to manage the application. Additionally, it outlines steps for exporting and restoring database data and changing user passwords.

Uploaded by

AB P
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

FRs Server Setup and Database Commands

The document provides instructions for setting up a project using Node.js and PostgreSQL, including commands for installing dependencies, starting servers, and managing user roles and permissions. It also includes SQL commands for creating databases, users, and inserting data into tables, as well as commands for using PM2 to manage the application. Additionally, it outlines steps for exporting and restoring database data and changing user passwords.

Uploaded by

AB P
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

open frs

in that open frs-server


in that once after code install node modules to install that you need to do npm
install
after nodemolues install you have to run srver bt npm start
----------------------------------------
to run frontend
================
open frs
in that fe-nmdc
after opening code do npm install
after that npm start

postgres commands
====================

create database loksunv2_prod;


create user frsuser with password 'P19C5J5hlTJvTMMDueaWxY6kYZKjRQP0';
alter role frsuser set client_encoding to 'utf8';
alter role frsuser set default_transaction_isolation to 'read Committed';
alter role frsuser set timezone to 'Asia/kolkata';
grant all privileges on database loksun to frsuser;
GRANT ALL ON SCHEMA public TO frsuser;

pm2 install globally:


-------------------------

npm install pm2 -g


npm install pm2 -g && pm2 update

insert public roles


--------------------

INSERT INTO "public"."roles" ("id", "name", "description", "createdAt",


"updatedAt", "deletedAt") VALUES
('76985452-9ef2-48b6-9bac-13ee0f84afc0', 'manager', 'Can access everyone in a
particular project (sub-location)', '2021-11-14 20:45:08.524764+05:30', '2021-11-14
20:45:08.524764+05:30', NULL),
('e0f18b8b-52b1-4ec7-a441-3ea9605c72f1', 'admin', 'Can access everyone in a
particular unit (location) and can create managers', '2021-11-14
20:45:08.524764+05:30', '2021-11-14 20:45:08.524764+05:30', NULL),
('e8b05d7a-e68b-4863-9af1-4702f422fbc9', 'superadmin', 'Can access everyone in the
system and can create admins & managers', '2021-11-14 20:45:08.524764+05:30',
'2021-11-14 20:45:08.524764+05:30', NULL);

insert into public users


---------------------------

INSERT INTO "public"."users" ("id", "firstName", "lastName", "email", "gender",


"password", "phoneNumber", "effectiveDate", "searchText", "createdAt", "updatedAt",
"deletedAt", "roleId", "hierarchyId") VALUES
('2dfcd8e0-fec4-40c6-9d41-b56ab538966a', 'NMDC', 'FRS', '[Link]@[Link]',
'male',
'CsCab6/ggo4EvPmzLHxy+wRpAX00dsYkKKDR8pPxWe8=$vlB3/JjwognmHoCwp6pd1GUnFIVPh6Womsoec
RGZNML7sXOsGTcIY/XDlx+puDvdL1hC1jjHF2Q/Oj4yu+dcpA==', '9966445577', NULL, 'nmdc
frs', '2021-11-16 20:57:35.973+05:30', '2021-11-16 20:57:35.973+05:30', NULL,
'e0f18b8b-52b1-4ec7-a441-3ea9605c72f1', NULL);

pm2 commands:
--------------

pm2 start ./bin/www -i max


pm2 start npm -- start

pm2 serve build 3000 --spa


delete the old buld and create an new build

[Link]

[Link]
[Link]

donumalai anydesk-Frs@1234

[Link]
Employee_DataSet?$filter=PA eq 'N002'&$format=json

[Link]
ZHR_SAP_FRS_EMPL_SHIFT_DATA_SRV/Employee_ShiftSet?$filter=PA eq 'N002'&$format=json

$filter=PA eq 'N002' and START_DATE eq '20220914' and END_DATE eq


'20220914'&$format=json

api2===[Link]
ZHR_SAP_FRS_EMPL_SHIFT_DATA_SRV/Employee_ShiftSet?$filter=PA eq 'N002' and
START_DATE eq '20220914' and END_DATE eq '20220914'&$format=json

mysql passsword:mouni

\copy (Select [Link], t1."date", t1."time", [Link], t1."createdAt",


t1."updatedAt", t2."employeeId" From punches as t1, employees as t2 WHERE
t1."employeeId" = [Link] and t1."createdAt" > '2022-07-01 21:25:22.462+05:30') To '\
Users\mouni\[Link]' With CSV DELIMITER ',' HEADER;
\copy (Select [Link], t1."createdAt", t1."updatedAt", t1.p10, t1.p20,
t2."employeeId" From attendances as t1, employees as t2 WHERE t1."employeeId" =
[Link] and t1."createdAt" > '2022-11-01 00:00:00.000+05:30') To '\Users\mouni\
[Link]' With CSV DELIMITER ',' HEADER;

to change database password if u forget:


-----------------------------------------
1)psql -U postgres -h localhost
2)enter password
3)ALTER USERNAME postgres with password '12345'

to dump the data of 1 month data from db:


=========================================
CREATE TEMPORARY TABLE temp_attendances AS
SELECT *
FROM attendances
WHERE "createdAt" >= '2023-05-01 00:00:00' AND "createdAt" < '2023-06-01 00:00:00';

to restore any .dump to psql cmd is


-----------------------------------
To restore a text format SQL dump file, you should use the psql command instead of
pg_restore. Here's how you can do it:

1) Open a terminal or command prompt.

2) Navigate to the directory where your SQL dump file ([Link]) is located
using the cd command.

3) Use the psql command to restore the database. The basic command structure is as
follows:
--> psql -U username -d database_name -f dump_file.sql

--> psql -U frsuser -d loksunv2_prod -f [Link]

When you run this command, psql will prompt you for your PostgreSQL password. Enter
the password when prompted.

The psql command will execute the SQL commands in the dump file, restoring the data
and schema to the specified database.

GRANT USAGE ON SCHEMA public TO frsuser;

You might also like