Skip to content

Commit 61ea524

Browse files
committed
2 parents 670b1ee + 714a645 commit 61ea524

File tree

78 files changed

+6741
-1943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+6741
-1943
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,19 @@ jobs:
285285
type=ref,event=pr
286286
type=sha
287287
288+
- name: Set build arguments for client
289+
id: build-args
290+
run: |
291+
if [[ "${{ matrix.service }}" == "client" ]]; then
292+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
293+
echo "build_env=production" >> $GITHUB_OUTPUT
294+
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
295+
echo "build_env=staging" >> $GITHUB_OUTPUT
296+
else
297+
echo "build_env=development" >> $GITHUB_OUTPUT
298+
fi
299+
fi
300+
288301
- name: Build and push Docker Image
289302
uses: docker/build-push-action@v5
290303
with:
@@ -294,6 +307,8 @@ jobs:
294307
push: true
295308
tags: ${{ steps.meta.outputs.tags }}
296309
labels: ${{ steps.meta.outputs.labels }}
310+
build-args: |
311+
${{ matrix.service == 'client' && format('BUILD_ENV={0}', steps.build-args.outputs.build_env) || '' }}
297312
cache-from: type=gha
298313
cache-to: type=gha,mode=max
299314

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,41 @@ This will start all services:
225225
- Weaviate Vector Database at [http://localhost:8087](http://localhost:8087)
226226
- MinIO Object Storage at [http://localhost:9000](http://localhost:9000) (API) and [http://localhost:9001](http://localhost:9001) (Console)
227227

228-
### Option 2: Manual Startup
228+
### 🚀 Development Environment (Default)
229+
230+
The default docker-compose setup is optimized for development:
231+
232+
```bash
233+
# Start development environment (default configuration)
234+
./start-dev.sh
235+
# OR manually:
236+
docker-compose up --build
237+
```
238+
239+
This setup:
240+
-**Development Mode**: Uses development environment configuration by default
241+
-**Real Backend**: All backend services running for full-stack development
242+
-**Easy Setup**: Single command to start the entire stack
243+
-**Environment Flexibility**: Can easily switch to staging or production builds
244+
245+
**Services Available:**
246+
- Client (Angular frontend) at [http://localhost:3000](http://localhost:3000)
247+
- All backend services running and connected
248+
249+
**Environment Options:**
250+
```bash
251+
# Development (default)
252+
docker-compose up --build
253+
254+
# Staging environment
255+
CLIENT_BUILD_ENV=staging docker-compose up --build
256+
257+
# Production environment
258+
CLIENT_BUILD_ENV=production docker-compose up --build
259+
```
260+
261+
262+
### Manual Development Setup
229263

230264
Before starting the services manually, you need to generate code from the OpenAPI specifications:
231265

client/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
FROM node:22-alpine AS builder
33
WORKDIR /app
44

5+
# Define build arguments
6+
ARG BUILD_ENV=production
7+
58
# speed up rebuilds: first copy lock files only
69
COPY package*.json ./
710
RUN npm ci --ignore-scripts
811

9-
# now copy sources and build for production
12+
# now copy sources and build for specified environment
1013
COPY . .
11-
RUN npm run build -- --configuration=production
14+
RUN npm run build -- --configuration=${BUILD_ENV}
1215

1316
# ---------- 2. RUNTIME STAGE ----------
1417
FROM nginx:1.27-alpine

client/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,73 @@ Angular CLI does not come with an end-to-end testing framework by default. You c
5757
## Additional Resources
5858

5959
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
60+
61+
## Environment Configuration
62+
63+
The application supports multiple environments:
64+
65+
- **Development**: Uses `environment.ts` (default for local development)
66+
- **Staging**: Uses `environment.staging.ts` (for the staging environment)
67+
- **Production**: Uses `environment.prod.ts` (for the production environment)
68+
69+
## Building with Docker
70+
71+
The Dockerfile supports building the application for different environments using the `BUILD_ENV` build argument.
72+
73+
### Building for Production (default)
74+
75+
```bash
76+
docker build -t client .
77+
```
78+
79+
This will use the production environment configuration by default.
80+
81+
### Building for Staging
82+
83+
```bash
84+
docker build -t client --build-arg BUILD_ENV=staging .
85+
```
86+
87+
This will use the staging environment configuration.
88+
89+
### Building for Development
90+
91+
```bash
92+
docker build -t client --build-arg BUILD_ENV=development .
93+
```
94+
95+
This will use the development environment configuration.
96+
97+
## Environment Configuration Files
98+
99+
The environment configuration files are located in `src/environments/`:
100+
101+
- `environment.ts`: Development environment
102+
- `environment.staging.ts`: Staging environment
103+
- `environment.prod.ts`: Production environment
104+
105+
Each file contains environment-specific settings like API URLs and feature flags.
106+
107+
## CI/CD Integration
108+
109+
The project's CI/CD pipeline automatically sets the appropriate `BUILD_ENV` value based on the Git branch:
110+
111+
- **main branch**: Uses `BUILD_ENV=production` for production deployments
112+
- **dev branch**: Uses `BUILD_ENV=staging` for staging deployments
113+
- **other branches**: Uses `BUILD_ENV=development` as a fallback
114+
115+
This is implemented in the GitHub Actions workflow (`.github/workflows/ci.yml`), which automatically builds and deploys the application with the correct environment configuration.
116+
117+
### Manual CI/CD Example
118+
119+
For manual CI/CD integration, you can use the `BUILD_ENV` build argument to specify the target environment:
120+
121+
```yaml
122+
# Example for staging deployment
123+
docker build -t client --build-arg BUILD_ENV=staging .
124+
125+
# Example for production deployment
126+
docker build -t client --build-arg BUILD_ENV=production .
127+
```
128+
129+
This ensures that the correct environment configuration is used for each deployment target.

client/angular.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,29 @@
5858
],
5959
"outputHashing": "all"
6060
},
61+
"staging": {
62+
"fileReplacements": [
63+
{
64+
"replace": "src/environments/environment.ts",
65+
"with": "src/environments/environment.staging.ts"
66+
}
67+
],
68+
"budgets": [
69+
{
70+
"type": "initial",
71+
"maximumWarning": "500kB",
72+
"maximumError": "1MB"
73+
},
74+
{
75+
"type": "anyComponentStyle",
76+
"maximumWarning": "4kB",
77+
"maximumError": "12kB"
78+
}
79+
],
80+
"outputHashing": "all",
81+
"optimization": true,
82+
"sourceMap": false
83+
},
6184
"development": {
6285
"optimization": false,
6386
"extractLicenses": false,
@@ -72,6 +95,9 @@
7295
"production": {
7396
"buildTarget": "concepter:build:production"
7497
},
98+
"staging": {
99+
"buildTarget": "concepter:build:staging"
100+
},
75101
"development": {
76102
"buildTarget": "concepter:build:development"
77103
}

client/src/app/core/models/concept.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface EventDetails {
3131
}
3232

3333
export interface AgendaItem {
34-
id: string;
34+
id?: string; // Made optional - backend will generate if not provided
3535
time: string;
3636
title: string;
3737
description?: string;
@@ -41,7 +41,7 @@ export interface AgendaItem {
4141
}
4242

4343
export interface Speaker {
44-
id: string;
44+
id?: string; // Made optional - backend will generate if not provided
4545
name: string;
4646
expertise: string;
4747
suggestedTopic?: string;

client/src/app/core/models/document.model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ export interface ProcessedDocument {
44
type: 'INDUSTRY_REPORT' | 'BRAND_DECK' | 'PAST_EVENT_DEBRIEF' | 'GUIDELINES' | 'OTHER';
55
status: 'PROCESSING' | 'COMPLETED' | 'FAILED';
66
s3Location: string;
7-
uploadedAt: Date;
8-
processedAt?: Date;
7+
uploadedAt: string; // ISO date-time string per OpenAPI spec
8+
processedAt?: string; // ISO date-time string per OpenAPI spec
99
}
1010

1111
export interface DocumentUploadResult {
1212
documentId: string;
1313
filename: string;
1414
size: number;
1515
mimeType: string;
16-
uploadedAt: Date;
16+
uploadedAt: string; // ISO date-time string per OpenAPI spec
1717
status: 'QUEUED' | 'PROCESSING' | 'COMPLETED' | 'FAILED';
1818
}

client/src/app/core/services/api.service.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@angular/core';
22
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
3-
import { Observable, catchError, throwError } from 'rxjs';
3+
import { Observable, catchError, of, throwError } from 'rxjs';
44
import { environment } from '../../../environments/environment';
55
import { MockApiService } from '../../mocks/services/mock-api.service';
66

@@ -41,6 +41,31 @@ export class ApiService {
4141
);
4242
}
4343

44+
// New method for downloading binary files (PDFs, images, etc.)
45+
downloadBlob(endpoint: string, params?: any): Observable<Blob> {
46+
if (environment.useMockApi) {
47+
// Return a mock PDF blob for development
48+
return of(new Blob(['Mock PDF content'], { type: 'application/pdf' })) as Observable<Blob>;
49+
}
50+
51+
let httpParams = new HttpParams();
52+
if (params) {
53+
Object.keys(params).forEach(key => {
54+
if (params[key] !== null && params[key] !== undefined) {
55+
httpParams = httpParams.set(key, params[key].toString());
56+
}
57+
});
58+
}
59+
60+
return this.http.get(`${this.baseUrl}${endpoint}`, {
61+
params: httpParams,
62+
responseType: 'blob' // This is crucial for binary data
63+
})
64+
.pipe(
65+
catchError(this.handleError)
66+
);
67+
}
68+
4469
post<T>(endpoint: string, data: any): Observable<T> {
4570
if (environment.useMockApi) {
4671
return this.handleMockRequest<T>('POST', endpoint, data);

0 commit comments

Comments
 (0)