Skip to content

Commit 13d1085

Browse files
schneiemschneiem
authored andcommitted
v0.23
1 parent 372b975 commit 13d1085

File tree

7 files changed

+51
-179
lines changed

7 files changed

+51
-179
lines changed

README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,12 @@ If you need to stop and remove all containers, networks, and all images used by
2424
docker compose down --rmi all
2525
```
2626

27-
For more detail, please visit:
28-
> [Docker Compose Node.js and Postgres example](https://www.bezkoder.com/docker-compose-nodejs-postgres/)
29-
30-
Related Posts:
31-
> [Node.js, Express & PostgreSQL: CRUD Rest Api example](https://www.bezkoder.com/node-express-sequelize-postgresql/)
32-
33-
> [Node.js Express Pagination with PostgreSQL example](https://www.bezkoder.com/node-js-pagination-postgresql/)
34-
35-
> [Import CSV data into PostgreSQL using Node.js](https://www.bezkoder.com/node-js-csv-postgresql/)
36-
37-
> [Export PostgreSQL data to CSV file using Node.js](https://www.bezkoder.com/node-js-export-postgresql-csv-file/)
38-
39-
> [Node.js JWT Authentication & Authorization with PostgreSQL example](https://www.bezkoder.com/node-js-jwt-authentication-postgresql/)
40-
41-
Associations:
42-
> [Sequelize Associations: One-to-Many Relationship example](https://bezkoder.com/sequelize-associate-one-to-many/)
27+
**Enter psql:**
28+
```bash
29+
psql ticketDB postgres
30+
```
4331

44-
> [Sequelize Associations: Many-to-Many Relationship example](https://bezkoder.com/sequelize-associate-many-to-many/)
32+
**Show all tables**
33+
```bash
34+
\dt
35+
```

tables/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
CREATE IF NOT EXISTS TABLE tutorials(
2+
CREATE TABLE IF NOT EXISTS tickets(
33
ID SERIAL PRIMARY KEY,
44
QR VARCHAR (31) NOT NULL,
55
STATUS VARCHAR (31) NOT NULL,

ticketNode/.env.sample

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ DB_USER=postgres
33
DB_PASSWORD=123456
44
DB_NAME=bezkoder_db
55
DB_PORT=5432
6-
7-
NODE_DOCKER_PORT=8080
6+
NODE_DOCKER_PORT=8080

ticketNode/README.md

Lines changed: 0 additions & 157 deletions
This file was deleted.

ticketNode/app/models/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, {
1616
const db = {};
1717

1818
db.Sequelize = Sequelize;
19-
db.sequelize = sequelize;
2019

2120
db.tutorials = require("./tutorial.model.js")(sequelize, Sequelize);
21+
db.tickets = require("./ticket.model.js")(sequelize, Sequelize);
2222

2323
module.exports = db;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
module.exports = (sequelize, Sequelize) => {
3+
4+
const Ticket = sequelize.define('tickets', {
5+
id: {
6+
type: Sequelize.INTEGER,
7+
primaryKey: true,
8+
autoIncrement: true
9+
},
10+
qr: {
11+
type: Sequelize.STRING(31),
12+
allowNull: false,
13+
field: 'QR'
14+
},
15+
status: {
16+
type: Sequelize.STRING(31),
17+
allowNull: false,
18+
field: 'STATUS'
19+
},
20+
mail: {
21+
type: Sequelize.STRING(127),
22+
field: 'MAIL'
23+
},
24+
mobile: {
25+
type: Sequelize.BIGINT,
26+
field: 'MOBILE'
27+
},
28+
scantime: {
29+
type: Sequelize.DATE,
30+
field: 'SCANTIME'
31+
}
32+
}, {
33+
timestamps: false,
34+
freezeTableName: true
35+
});
36+
37+
return Ticket;
38+
};

ticketNode/app/models/tutorial.model.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = (sequelize, Sequelize) => {
2-
const Tutorial = sequelize.define("tutorial", {
2+
3+
const Tutorial = sequelize.define("tickets", {
34
title: {
45
type: Sequelize.STRING
56
},

0 commit comments

Comments
 (0)