Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the setup script to handle sample data import for Docker #2751

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ services:
- "80:80"
- "443:443"
volumes:
- $PWD/Caddyfile:/etc/caddy/Caddyfile
- ./Caddyfile:/etc/caddy/Caddyfile
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
- $PWD/site:/srv
- caddy_data:/data
- caddy_config:/config
Expand Down
34 changes: 34 additions & 0 deletions sample_data/venue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"_id": "6437904485008f171cf29925",
"name": "Unity Foundation",
"description": "A large hall for community events in the Bronx.",
"capacity": 500,
"imageUrl": "https://example.com/bronx-hall.jpg",
"organization": "6437904485008f171cf29924"
},
{
"_id": "6537904485008f171cf29925",
"name": "Unity Conference Room - Queens",
"description": "A small conference room for meetings in Queens.",
"capacity": 50,
"imageUrl": "https://example.com/queens-conference-room.jpg",
"organization": "6537904485008f171cf29924"
},
{
"_id": "6637904485008f171cf29925",
"name": "Unity Arena - Staten Island",
"description": "A large outdoor arena for public events in Staten Island.",
"capacity": 2000,
"imageUrl": "https://example.com/staten-island-arena.jpg",
"organization": "6637904485008f171cf29924"
},
{
"_id": "6737904485008f171cf29925",
"name": "Unity Hall - Brooklyn",
"description": "A community hall in Brooklyn for social events.",
"capacity": 300,
"imageUrl": "https://example.com/brooklyn-hall.jpg",
"organization": "6737904485008f171cf29924"
}
]
11 changes: 10 additions & 1 deletion src/models/SampleData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface InterfaceSampleData extends Document {
| "Organization"
| "Post"
| "Event"
| "Venue"
| "User"
| "Plugin"
| "AppUserProfile";
Expand All @@ -28,7 +29,15 @@ const sampleDataSchema = new Schema<InterfaceSampleData>({
collectionName: {
type: String,
required: true,
enum: ["Organization", "Post", "Event", "User", "AppUserProfile", "Plugin"],
enum: [
"Organization",
"Post",
"Event",
"Venue",
"User",
"AppUserProfile",
"Plugin",
],
},
});

Expand Down
6 changes: 6 additions & 0 deletions src/utilities/loadSampleData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Organization,
Post,
User,
Venue,
} from "../models";
import { RecurrenceRule } from "../models/RecurrenceRule";

Expand Down Expand Up @@ -128,6 +129,9 @@ async function insertCollections(collections: string[]): Promise<void> {
case "events":
await Event.insertMany(docs);
break;
case "venue":
await Venue.insertMany(docs);
break;
case "recurrenceRules":
await RecurrenceRule.insertMany(docs);
break;
Expand Down Expand Up @@ -172,6 +176,7 @@ async function checkCountAfterImport(): Promise<void> {
{ name: "events", model: Event },
{ name: "recurrenceRules", model: RecurrenceRule },
{ name: "posts", model: Post },
{ name: "venue", model: Venue },
{ name: "appUserProfiles", model: AppUserProfile },
];

Expand Down Expand Up @@ -201,6 +206,7 @@ const collections = [
"organizations",
"posts",
"events",
"venue",
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
"recurrenceRules",
"appUserProfiles",
"actionItemCategories",
Expand Down
2 changes: 2 additions & 0 deletions src/utilities/removeSampleOrganizationUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Organization,
Plugin,
Post,
Venue,
SampleData,
User,
} from "../models";
Expand All @@ -27,6 +28,7 @@ export async function removeSampleOrganization(): Promise<void> {
Post,
Event,
User,
Venue,
Plugin,
AppUserProfile,
};
Expand Down
Loading