- {section.fields.map(field => renderField(field))}
+ {currentStepData?.sections.map(section => (
+
))}
{currentStep === 'A' && (
-
-
+
+
)}
{currentStep === 'B' && (
)}
@@ -203,4 +348,4 @@ const SubmitProjectPage = () => {
);
};
-export { SubmitProjectPage };
\ No newline at end of file
+export { SubmitProjectPage };
\ No newline at end of file
diff --git a/frontend/src/services/company.ts b/frontend/src/services/company.ts
new file mode 100644
index 00000000..357d0b40
--- /dev/null
+++ b/frontend/src/services/company.ts
@@ -0,0 +1,41 @@
+import { getApiUrl, HttpStatusCode } from '@utils';
+import { ApiError } from './errors';
+
+interface CreateCompanyResponse {
+ id: string;
+ owner_user_id: string;
+ name: string;
+ description: string | null;
+ is_verified: boolean;
+ created_at: string;
+ updated_at: string;
+}
+
+export async function createCompany(
+ ownerUserId: string,
+ name: string,
+ description?: string
+): Promise
{
+ const url = getApiUrl('/companies');
+ const body = {
+ owner_user_id: ownerUserId,
+ name,
+ description
+ };
+
+ const res = await fetch(url, {
+ method: 'POST',
+ body: JSON.stringify(body),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ });
+
+ const json = await res.json();
+
+ if (res.status !== HttpStatusCode.CREATED) {
+ throw new ApiError('Failed to create company', res.status, json);
+ }
+
+ return json as CreateCompanyResponse;
+}
\ No newline at end of file
diff --git a/frontend/src/services/index.ts b/frontend/src/services/index.ts
index 86eb35d9..58303032 100644
--- a/frontend/src/services/index.ts
+++ b/frontend/src/services/index.ts
@@ -1,2 +1,5 @@
export { register, saveRefreshToken } from './auth';
export { RegisterError, ApiError, API_ERROR, REGISTER_ERROR } from './errors';
+export { createProject } from './project';
+export { createCompany } from './company';
+export { uploadFile } from './storage';
diff --git a/frontend/src/services/project.ts b/frontend/src/services/project.ts
new file mode 100644
index 00000000..1fa4444c
--- /dev/null
+++ b/frontend/src/services/project.ts
@@ -0,0 +1,78 @@
+import { getApiUrl, HttpStatusCode } from '@utils';
+import { ApiError } from './errors';
+import type { FormData } from '@/types';
+import { uploadFile } from './storage';
+
+interface CreateProjectResponse {
+ id: string;
+ company_id: string;
+ title: string;
+ description: string | null;
+ status: string;
+ created_at: string;
+ updated_at: string;
+}
+
+interface ProjectFile {
+ file_type: string;
+ file_url: string;
+}
+
+interface ProjectLink {
+ link_type: string;
+ url: string;
+}
+
+export async function createProject(
+ companyId: string,
+ formData: FormData,
+ files: File[] = [],
+ links: { type: string; url: string }[] = []
+): Promise {
+ // First upload all files
+ const uploadedFiles: ProjectFile[] = await Promise.all(
+ files.map(async (file) => {
+ const fileUrl = await uploadFile(file);
+ return {
+ file_type: file.type,
+ file_url: fileUrl
+ };
+ })
+ );
+
+ // Create project with files and links
+ const url = getApiUrl('/projects');
+ const body = {
+ company_id: companyId,
+ title: formData.companyName,
+ description: formData.description,
+ status: 'pending',
+ founded_date: formData.foundedDate,
+ company_stage: formData.companyStage,
+ investment_stage: formData.investmentStage,
+ inspiration: formData.inspiration,
+ vision: formData.vision,
+ team_members: formData['team-members'],
+ files: uploadedFiles,
+ links: links.map(link => ({
+ link_type: link.type,
+ url: link.url
+ }))
+ };
+
+ const res = await fetch(url, {
+ method: 'POST',
+ body: JSON.stringify(body),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ });
+
+ const json = await res.json();
+
+ if (res.status !== HttpStatusCode.CREATED) {
+ throw new ApiError('Failed to create project', res.status, json);
+ }
+
+ return json as CreateProjectResponse;
+}
\ No newline at end of file
diff --git a/frontend/src/services/storage.ts b/frontend/src/services/storage.ts
new file mode 100644
index 00000000..7ac8946e
--- /dev/null
+++ b/frontend/src/services/storage.ts
@@ -0,0 +1,34 @@
+import { getApiUrl, HttpStatusCode } from '@utils';
+import { ApiError } from './errors';
+
+interface UploadResponse {
+ file_url: string;
+}
+
+export async function uploadFile(file: File): Promise {
+ const url = getApiUrl('/storage/upload');
+ const formData = new FormData();
+ formData.append('file', file);
+
+ try {
+ const res = await fetch(url, {
+ method: 'POST',
+ body: formData,
+ headers: {
+ 'Accept': 'application/json',
+ },
+ });
+
+ if (!res.ok) {
+ const json = await res.json().catch(() => ({ message: 'Upload failed' }));
+ console.error('Upload failed:', json);
+ throw new ApiError('Failed to upload file', res.status, json);
+ }
+
+ const json = await res.json();
+ return (json as UploadResponse).file_url;
+ } catch (err) {
+ console.error('Upload error:', err);
+ throw err;
+ }
+}
\ No newline at end of file
diff --git a/frontend/src/utils/Router.tsx b/frontend/src/utils/Router.tsx
index c253ece5..784aac74 100644
--- a/frontend/src/utils/Router.tsx
+++ b/frontend/src/utils/Router.tsx
@@ -1,31 +1,34 @@
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { Landing, Register, DashboardPage, AdminDashboardPage, SubmitProjectPage } from '@pages';
+import { AuthProvider } from '@/contexts/AuthContext';
const Router = () => (
-
-
- } />
- } />
-
- {/* User routes */}
- } />
- } />
- } />
- } />
- } />
- } />
- } />
-
- {/* Admin routes */}
- } />
- } />
- } />
- } />
- } />
- } />
- } />
-
-
+
+
+
+ } />
+ } />
+
+ {/* User routes */}
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+ {/* Admin routes */}
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
+
);
export { Router };
\ No newline at end of file
From 3cbe936c47c1c0a12d58ef086ddac288d926cd7f Mon Sep 17 00:00:00 2001
From: AmirAgassi <33383085+AmirAgassi@users.noreply.github.com>
Date: Thu, 5 Dec 2024 20:05:20 -0500
Subject: [PATCH 09/14] move database connection logic to separate file
---
backend/db/db.go | 29 +----------------------------
backend/internal/server/index.go | 15 +++++++++++++--
2 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/backend/db/db.go b/backend/db/db.go
index 0bf8ab24..9a430b56 100644
--- a/backend/db/db.go
+++ b/backend/db/db.go
@@ -6,8 +6,6 @@ package db
import (
"context"
- "fmt"
- "os"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
@@ -32,29 +30,4 @@ func (q *Queries) WithTx(tx pgx.Tx) *Queries {
return &Queries{
db: tx,
}
-}
-
-// Connect initializes and returns a new database connection pool
-func Connect() (*pgxpool.Pool, error) {
- connStr := fmt.Sprintf(
- "host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
- os.Getenv("DB_HOST"),
- os.Getenv("DB_PORT"),
- os.Getenv("DB_USER"),
- os.Getenv("DB_PASSWORD"),
- os.Getenv("DB_NAME"),
- os.Getenv("DB_SSLMODE"),
- )
-
- config, err := pgxpool.ParseConfig(connStr)
- if err != nil {
- return nil, fmt.Errorf("unable to parse connection string: %v", err)
- }
-
- pool, err := pgxpool.NewWithConfig(context.Background(), config)
- if err != nil {
- return nil, fmt.Errorf("unable to create connection pool: %v", err)
- }
-
- return pool, nil
-}
+}
\ No newline at end of file
diff --git a/backend/internal/server/index.go b/backend/internal/server/index.go
index 614974a4..74b16768 100644
--- a/backend/internal/server/index.go
+++ b/backend/internal/server/index.go
@@ -33,8 +33,19 @@ func New(testing bool) (*Server, error) {
s := &Server{}
if !testing {
- // Initialize database connection
- dbPool, err := db.Connect()
+ // format connection string
+ connStr := fmt.Sprintf(
+ "host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
+ os.Getenv("DB_HOST"),
+ os.Getenv("DB_PORT"),
+ os.Getenv("DB_USER"),
+ os.Getenv("DB_PASSWORD"),
+ os.Getenv("DB_NAME"),
+ os.Getenv("DB_SSLMODE"),
+ )
+
+ // initialize database connection using pool.go
+ dbPool, err := db.NewPool(connStr)
if err != nil {
return nil, fmt.Errorf("failed to connect to database: %v", err)
}
From 17719b95cd9dbbcb52255cbb79467c458df33aef Mon Sep 17 00:00:00 2001
From: AmirAgassi <33383085+AmirAgassi@users.noreply.github.com>
Date: Thu, 5 Dec 2024 20:05:53 -0500
Subject: [PATCH 10/14] simplify server initialization and remove db connection
wrapper
---
backend/internal/server/index.go | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/backend/internal/server/index.go b/backend/internal/server/index.go
index 74b16768..293d7b08 100644
--- a/backend/internal/server/index.go
+++ b/backend/internal/server/index.go
@@ -30,7 +30,10 @@ type Server struct {
// Create a new Server instance and registers all routes and middlewares.
// Initialize database pool connection.
func New(testing bool) (*Server, error) {
- s := &Server{}
+ var dbPool *pgxpool.Pool
+ var queries *db.Queries
+ var storage *storage.Storage
+ var err error
if !testing {
// format connection string
@@ -45,19 +48,17 @@ func New(testing bool) (*Server, error) {
)
// initialize database connection using pool.go
- dbPool, err := db.NewPool(connStr)
+ dbPool, err = db.NewPool(connStr)
if err != nil {
return nil, fmt.Errorf("failed to connect to database: %v", err)
}
- s.DBPool = dbPool
- s.queries = db.New(dbPool)
+ queries = db.New(dbPool)
// Initialize storage
- storage, err := storage.NewStorage()
+ storage, err = storage.NewStorage()
if err != nil {
return nil, fmt.Errorf("failed to initialize storage: %v", err)
}
- s.Storage = storage
}
e := echo.New()
@@ -83,11 +84,12 @@ func New(testing bool) (*Server, error) {
}
server := &Server{
- DBPool: s.DBPool,
- queries: s.queries,
+ DBPool: dbPool,
+ queries: queries,
echoInstance: e,
authLimiter: authLimiter,
apiLimiter: apiLimiter,
+ Storage: storage,
}
// setup api routes first
From d75136662059581d081120a7b39d5bbe31197e59 Mon Sep 17 00:00:00 2001
From: AmirAgassi <33383085+AmirAgassi@users.noreply.github.com>
Date: Thu, 5 Dec 2024 20:07:01 -0500
Subject: [PATCH 11/14] simplify CORS middleware in development environment
---
backend/internal/server/index.go | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/backend/internal/server/index.go b/backend/internal/server/index.go
index 293d7b08..a7b89c84 100644
--- a/backend/internal/server/index.go
+++ b/backend/internal/server/index.go
@@ -111,19 +111,8 @@ func New(testing bool) (*Server, error) {
// setup error handler and middlewares after routes
e.HTTPErrorHandler = globalErrorHandler
- if os.Getenv("APP_ENV") == common.DEVELOPMENT_ENV {
- e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
- AllowOrigins: []string{"*"},
- AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
- AllowHeaders: []string{
- echo.HeaderOrigin,
- echo.HeaderContentType,
- echo.HeaderAccept,
- echo.HeaderContentLength,
- "X-Request-ID",
- },
- }))
- } else if os.Getenv("APP_ENV") == common.PRODUCTION_ENV {
+ // setup cors based on environment
+ if os.Getenv("APP_ENV") == common.PRODUCTION_ENV {
e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
AllowOrigins: []string{"https://spur.konfer.ca"},
AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
@@ -135,7 +124,7 @@ func New(testing bool) (*Server, error) {
"X-Request-ID",
},
}))
- } else {
+ } else if os.Getenv("APP_ENV") == common.STAGING_ENV {
e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
AllowOrigins: []string{"https://nk-preview.konfer.ca"},
AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
@@ -147,6 +136,9 @@ func New(testing bool) (*Server, error) {
"X-Request-ID",
},
}))
+ } else {
+ // use default cors middleware for development
+ e.Use(echoMiddleware.CORS())
}
e.Use(middleware.Logger())
From 15510346d146d58c596975b75e067dc5daf8f6e0 Mon Sep 17 00:00:00 2001
From: AmirAgassi <33383085+AmirAgassi@users.noreply.github.com>
Date: Thu, 5 Dec 2024 20:07:50 -0500
Subject: [PATCH 12/14] reorder middleware setup before routes
---
backend/internal/server/index.go | 83 ++++++++------------------------
1 file changed, 19 insertions(+), 64 deletions(-)
diff --git a/backend/internal/server/index.go b/backend/internal/server/index.go
index a7b89c84..52467295 100644
--- a/backend/internal/server/index.go
+++ b/backend/internal/server/index.go
@@ -64,35 +64,30 @@ func New(testing bool) (*Server, error) {
e := echo.New()
e.Debug = true
- // create rate limiters
- var authLimiter, apiLimiter *middleware.RateLimiter
+ // setup error handler and global middlewares first
+ e.HTTPErrorHandler = globalErrorHandler
- if testing {
- authLimiter = middleware.NewTestRateLimiter(20)
- apiLimiter = middleware.NewTestRateLimiter(100)
+ if os.Getenv("APP_ENV") == common.DEVELOPMENT_ENV {
+ // use default cors config, allow everything in development
+ e.Use(echoMiddleware.CORS())
+ } else if os.Getenv("APP_ENV") == common.PRODUCTION_ENV {
+ e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
+ AllowOrigins: []string{"https://spur.konfer.ca"},
+ }))
} else {
- authLimiter = middleware.NewRateLimiter(
- 20, // 20 requests
- 5*time.Minute, // per 5 minutes
- 15*time.Minute, // block for 15 minutes if exceeded
- )
- apiLimiter = middleware.NewRateLimiter(
- 100, // 100 requests
- time.Minute, // per minute
- 5*time.Minute, // block for 5 minutes if exceeded
- )
+ e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
+ AllowOrigins: []string{"https://nk-preview.konfer.ca"},
+ }))
}
- server := &Server{
- DBPool: dbPool,
- queries: queries,
- echoInstance: e,
- authLimiter: authLimiter,
- apiLimiter: apiLimiter,
- Storage: storage,
- }
+ e.Use(middleware.Logger())
+ e.Use(echoMiddleware.Recover())
+ e.Use(apiLimiter.RateLimit()) // global rate limit
- // setup api routes first
+ customValidator := middleware.NewRequestBodyValidator()
+ e.Validator = customValidator
+
+ // setup api routes after middleware
server.setupV1Routes()
server.setupAuthRoutes()
server.setupCompanyRoutes()
@@ -108,46 +103,6 @@ func New(testing bool) (*Server, error) {
server.setupHealthRoutes()
server.setupStorageRoutes()
- // setup error handler and middlewares after routes
- e.HTTPErrorHandler = globalErrorHandler
-
- // setup cors based on environment
- if os.Getenv("APP_ENV") == common.PRODUCTION_ENV {
- e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
- AllowOrigins: []string{"https://spur.konfer.ca"},
- AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
- AllowHeaders: []string{
- echo.HeaderOrigin,
- echo.HeaderContentType,
- echo.HeaderAccept,
- echo.HeaderContentLength,
- "X-Request-ID",
- },
- }))
- } else if os.Getenv("APP_ENV") == common.STAGING_ENV {
- e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
- AllowOrigins: []string{"https://nk-preview.konfer.ca"},
- AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
- AllowHeaders: []string{
- echo.HeaderOrigin,
- echo.HeaderContentType,
- echo.HeaderAccept,
- echo.HeaderContentLength,
- "X-Request-ID",
- },
- }))
- } else {
- // use default cors middleware for development
- e.Use(echoMiddleware.CORS())
- }
-
- e.Use(middleware.Logger())
- e.Use(echoMiddleware.Recover())
- e.Use(apiLimiter.RateLimit()) // global rate limit
-
- customValidator := middleware.NewRequestBodyValidator()
- e.Validator = customValidator
-
// setup static routes last
server.setupStaticRoutes()
From cd7a138231c3a9dda532e04e98989a4d44678cf6 Mon Sep 17 00:00:00 2001
From: AmirAgassi <33383085+AmirAgassi@users.noreply.github.com>
Date: Thu, 5 Dec 2024 20:09:35 -0500
Subject: [PATCH 13/14] enable database connection during tests
---
backend/internal/server/index.go | 121 +++++++++++++++++++++----------
1 file changed, 83 insertions(+), 38 deletions(-)
diff --git a/backend/internal/server/index.go b/backend/internal/server/index.go
index 52467295..9d92488c 100644
--- a/backend/internal/server/index.go
+++ b/backend/internal/server/index.go
@@ -35,26 +35,26 @@ func New(testing bool) (*Server, error) {
var storage *storage.Storage
var err error
- if !testing {
- // format connection string
- connStr := fmt.Sprintf(
- "host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
- os.Getenv("DB_HOST"),
- os.Getenv("DB_PORT"),
- os.Getenv("DB_USER"),
- os.Getenv("DB_PASSWORD"),
- os.Getenv("DB_NAME"),
- os.Getenv("DB_SSLMODE"),
- )
-
- // initialize database connection using pool.go
- dbPool, err = db.NewPool(connStr)
- if err != nil {
- return nil, fmt.Errorf("failed to connect to database: %v", err)
- }
- queries = db.New(dbPool)
+ // format connection string
+ connStr := fmt.Sprintf(
+ "host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
+ os.Getenv("DB_HOST"),
+ os.Getenv("DB_PORT"),
+ os.Getenv("DB_USER"),
+ os.Getenv("DB_PASSWORD"),
+ os.Getenv("DB_NAME"),
+ os.Getenv("DB_SSLMODE"),
+ )
+
+ // initialize database connection using pool.go
+ dbPool, err = db.NewPool(connStr)
+ if err != nil {
+ return nil, fmt.Errorf("failed to connect to database: %v", err)
+ }
+ queries = db.New(dbPool)
- // Initialize storage
+ if !testing {
+ // Initialize storage only for non-test environment
storage, err = storage.NewStorage()
if err != nil {
return nil, fmt.Errorf("failed to initialize storage: %v", err)
@@ -64,30 +64,35 @@ func New(testing bool) (*Server, error) {
e := echo.New()
e.Debug = true
- // setup error handler and global middlewares first
- e.HTTPErrorHandler = globalErrorHandler
+ // create rate limiters
+ var authLimiter, apiLimiter *middleware.RateLimiter
- if os.Getenv("APP_ENV") == common.DEVELOPMENT_ENV {
- // use default cors config, allow everything in development
- e.Use(echoMiddleware.CORS())
- } else if os.Getenv("APP_ENV") == common.PRODUCTION_ENV {
- e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
- AllowOrigins: []string{"https://spur.konfer.ca"},
- }))
+ if testing {
+ authLimiter = middleware.NewTestRateLimiter(20)
+ apiLimiter = middleware.NewTestRateLimiter(100)
} else {
- e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
- AllowOrigins: []string{"https://nk-preview.konfer.ca"},
- }))
+ authLimiter = middleware.NewRateLimiter(
+ 20, // 20 requests
+ 5*time.Minute, // per 5 minutes
+ 15*time.Minute, // block for 15 minutes if exceeded
+ )
+ apiLimiter = middleware.NewRateLimiter(
+ 100, // 100 requests
+ time.Minute, // per minute
+ 5*time.Minute, // block for 5 minutes if exceeded
+ )
}
- e.Use(middleware.Logger())
- e.Use(echoMiddleware.Recover())
- e.Use(apiLimiter.RateLimit()) // global rate limit
-
- customValidator := middleware.NewRequestBodyValidator()
- e.Validator = customValidator
+ server := &Server{
+ DBPool: dbPool,
+ queries: queries,
+ echoInstance: e,
+ authLimiter: authLimiter,
+ apiLimiter: apiLimiter,
+ Storage: storage,
+ }
- // setup api routes after middleware
+ // setup api routes first
server.setupV1Routes()
server.setupAuthRoutes()
server.setupCompanyRoutes()
@@ -103,6 +108,46 @@ func New(testing bool) (*Server, error) {
server.setupHealthRoutes()
server.setupStorageRoutes()
+ // setup error handler and middlewares after routes
+ e.HTTPErrorHandler = globalErrorHandler
+
+ // setup cors based on environment
+ if os.Getenv("APP_ENV") == common.PRODUCTION_ENV {
+ e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
+ AllowOrigins: []string{"https://spur.konfer.ca"},
+ AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
+ AllowHeaders: []string{
+ echo.HeaderOrigin,
+ echo.HeaderContentType,
+ echo.HeaderAccept,
+ echo.HeaderContentLength,
+ "X-Request-ID",
+ },
+ }))
+ } else if os.Getenv("APP_ENV") == common.STAGING_ENV {
+ e.Use(echoMiddleware.CORSWithConfig(echoMiddleware.CORSConfig{
+ AllowOrigins: []string{"https://nk-preview.konfer.ca"},
+ AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
+ AllowHeaders: []string{
+ echo.HeaderOrigin,
+ echo.HeaderContentType,
+ echo.HeaderAccept,
+ echo.HeaderContentLength,
+ "X-Request-ID",
+ },
+ }))
+ } else {
+ // use default cors middleware for development
+ e.Use(echoMiddleware.CORS())
+ }
+
+ e.Use(middleware.Logger())
+ e.Use(echoMiddleware.Recover())
+ e.Use(apiLimiter.RateLimit()) // global rate limit
+
+ customValidator := middleware.NewRequestBodyValidator()
+ e.Validator = customValidator
+
// setup static routes last
server.setupStaticRoutes()
From 0af4b7ffdc34a6e4b4d31e239d65a65daf144647 Mon Sep 17 00:00:00 2001
From: AmirAgassi <33383085+AmirAgassi@users.noreply.github.com>
Date: Thu, 5 Dec 2024 20:22:55 -0500
Subject: [PATCH 14/14] quick fix
---
backend/common/env_name.go | 1 +
backend/db/db.go | 1 -
backend/internal/server/index.go | 6 +++---
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/backend/common/env_name.go b/backend/common/env_name.go
index a036ae4e..841cfe54 100644
--- a/backend/common/env_name.go
+++ b/backend/common/env_name.go
@@ -2,3 +2,4 @@ package common
const PRODUCTION_ENV = "production"
const DEVELOPMENT_ENV = "development"
+const STAGING_ENV = "staging"
diff --git a/backend/db/db.go b/backend/db/db.go
index 9a430b56..5470edf8 100644
--- a/backend/db/db.go
+++ b/backend/db/db.go
@@ -9,7 +9,6 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
- "github.com/jackc/pgx/v5/pgxpool"
)
type DBTX interface {
diff --git a/backend/internal/server/index.go b/backend/internal/server/index.go
index 9d92488c..c0603a01 100644
--- a/backend/internal/server/index.go
+++ b/backend/internal/server/index.go
@@ -32,7 +32,7 @@ type Server struct {
func New(testing bool) (*Server, error) {
var dbPool *pgxpool.Pool
var queries *db.Queries
- var storage *storage.Storage
+ var storageClient *storage.Storage
var err error
// format connection string
@@ -55,7 +55,7 @@ func New(testing bool) (*Server, error) {
if !testing {
// Initialize storage only for non-test environment
- storage, err = storage.NewStorage()
+ storageClient, err = storage.NewStorage()
if err != nil {
return nil, fmt.Errorf("failed to initialize storage: %v", err)
}
@@ -89,7 +89,7 @@ func New(testing bool) (*Server, error) {
echoInstance: e,
authLimiter: authLimiter,
apiLimiter: apiLimiter,
- Storage: storage,
+ Storage: storageClient,
}
// setup api routes first