Skip to content

Commit

Permalink
Generated schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
nroh555 committed Jun 19, 2024
1 parent 860386c commit 1a0281e
Show file tree
Hide file tree
Showing 6 changed files with 1,706 additions and 90 deletions.
18 changes: 0 additions & 18 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,6 @@ ENV DATABASE_PORT=${DATABASE_PORT}
ENV DATABASE_USERNAME=${DATABASE_USERNAME}
ENV DATABASE_PASSWORD=${DATABASE_PASSWORD}

# Copy drizzle configuration file
COPY drizzle.config.ts .

# Copy schemas folder from api directory
COPY schemas ./schemas

#Copy migrate script from api directory
COPY scripts ./scripts

#Copy db config script from api directory
COPY db ./db

#Need to run the generation and migration
RUN yarn run db

#Runs the seed script to populate some data
RUN yarn run db:seed

# Copy application code
COPY --link . .

Expand Down
150 changes: 78 additions & 72 deletions api/db/sampleEvents.ts
Original file line number Diff line number Diff line change
@@ -1,76 +1,82 @@
const events = [
{
_id: '1',
title: 'Live Concert: Wireless Beats',
imageUrl: '/images/concert.jpg',
description: 'Experience an immersive listening journey with our live concert event. Featuring state-of-the-art Bluetooth technology, high-quality AAC audio, and interactive experiences to connect with your favorite music like never before.',
organizer: 'Apple',
category: 'Music',
price: 89.99,
seatsAvailable: 1000,
rating: 4.5,
numReviews: 12,
},
{
_id: '2',
title: 'Tech Talk: iPhone 11 Pro Innovations',
imageUrl: '/images/techtalk.jpg',
description: 'Join us for a deep dive into the iPhone 11 Pro. Discover the transformative triple-camera system and significant leaps in battery life and performance.',
organizer: 'Apple',
category: 'Technology',
price: 599.99,
seatsAvailable: 500,
rating: 4.0,
numReviews: 8,
},
{
_id: '3',
title: 'Photography Workshop: Canon EOS 80D',
imageUrl: '/images/workshop.jpg',
description: 'Explore the Canon EOS 80D with hands-on guidance in our workshop. Learn about its versatile imaging specs, robust focusing systems, and intuitive design from industry experts.',
organizer: 'Cannon',
category: 'Photography',
price: 929.99,
seatsAvailable: 15,
rating: 3,
numReviews: 12,
},
{
_id: '4',
title: 'Gaming Marathon: Playstation 4 Pro Showdown',
imageUrl: '/images/gaming.jpg',
description: 'The ultimate gaming marathon is here. Join us for non-stop PlayStation action, featuring HD movies, music, and the best games on the market.',
organizer: 'Sony',
category: 'Gaming',
price: 399.99,
seatsAvailable: 200,
rating: 5,
numReviews: 12,
},
{
_id: '5',
title: 'Esports Tournament: Ultimate Gaming Challenge',
imageUrl: '/images/esports.jpg',
description: 'Get ready for the Logitech LIGHTSYNC Esports Tournament. Customize your play with programmable buttons and experience gaming like never before.',
organizer: 'Logitech',
category: 'Gaming',
price: 49.99,
seatsAvailable: 100,
rating: 3.5,
numReviews: 10,
},
{
_id: '6',
title: 'Smart Home Seminar: Amazon Echo Dot Masterclass',
imageUrl: '/images/smarthome.jpg',
description: 'Meet Echo Dot in our smart home seminar. Discover compact design and how it fits into your smart home ecosystem, offering hands-free help in any room.',
organizer: 'Amazon',
category: 'Technology',
price: 29.99,
seatsAvailable: 0, // Could indicate sold out or not available
rating: 4,
numReviews: 12,
},
{
_id: "1",
title: "Live Concert: Wireless Beats",
imageUrl: "/images/concert.jpg",
description:
"Experience an immersive listening journey with our live concert event. Featuring state-of-the-art Bluetooth technology, high-quality AAC audio, and interactive experiences to connect with your favorite music like never before.",
organizer: "Apple",
category: "Music",
price: 89.99,
seatsAvailable: 1000,
rating: 4.5,
numReviews: 12,
},
{
_id: "2",
title: "Tech Talk: iPhone 11 Pro Innovations",
imageUrl: "/images/techtalk.jpg",
description:
"Join us for a deep dive into the iPhone 11 Pro. Discover the transformative triple-camera system and significant leaps in battery life and performance.",
organizer: "Apple",
category: "Technology",
price: 599.99,
seatsAvailable: 500,
rating: 4.0,
numReviews: 8,
},
{
_id: "3",
title: "Photography Workshop: Canon EOS 80D",
imageUrl: "/images/workshop.jpg",
description:
"Explore the Canon EOS 80D with hands-on guidance in our workshop. Learn about its versatile imaging specs, robust focusing systems, and intuitive design from industry experts.",
organizer: "Cannon",
category: "Photography",
price: 929.99,
seatsAvailable: 15,
rating: 3,
numReviews: 12,
},
{
_id: "4",
title: "Gaming Marathon: Playstation 4 Pro Showdown",
imageUrl: "/images/gaming.jpg",
description:
"The ultimate gaming marathon is here. Join us for non-stop PlayStation action, featuring HD movies, music, and the best games on the market.",
organizer: "Sony",
category: "Gaming",
price: 399.99,
seatsAvailable: 200,
rating: 5,
numReviews: 12,
},
{
_id: "5",
title: "Esports Tournament: Ultimate Gaming Challenge",
imageUrl: "/images/esports.jpg",
description:
"Get ready for the Logitech LIGHTSYNC Esports Tournament. Customize your play with programmable buttons and experience gaming like never before.",
organizer: "Logitech",
category: "Gaming",
price: 49.99,
seatsAvailable: 100,
rating: 3.5,
numReviews: 10,
},
{
_id: "6",
title: "Smart Home Seminar: Amazon Echo Dot Masterclass",
imageUrl: "/images/smarthome.jpg",
description:
"Meet Echo Dot in our smart home seminar. Discover compact design and how it fits into your smart home ecosystem, offering hands-free help in any room.",
organizer: "Amazon",
category: "Technology",
price: 29.99,
seatsAvailable: 0, // Could indicate sold out or not available
rating: 4,
numReviews: 12,
},
];

export default events;
14 changes: 14 additions & 0 deletions api/drizzle-schema.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as dotenv from "dotenv";
dotenv.config();
import { defineConfig } from "drizzle-kit";

export default defineConfig({
schema: "./schemas/*",
out: "./schemas",
dialect: "postgresql",
dbCredentials: {
url: process.env.DATABASE_URL!,
},
verbose: true,
strict: true,
});
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"db:seed": "node -r esbuild-register ./scripts/seed.ts",
"db": "yarn db:generate && yarn db:migrate",
"db:visualise": "drizzle-kit studio",
"db:pull": " drizzle-kit introspect --config=drizzle-schema.config.ts",
"generate-types": "quicktype ../api/types/types.ts -o ../web/src/types/backend-types.ts --just-types",
"watch-types": "nodemon -e ts -x \"yarn generate-types\""
},
Expand Down
Loading

0 comments on commit 1a0281e

Please sign in to comment.