Compare commits
101 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d8bbb22dbd | |||
| 4da00b222f | |||
| cfb97d976f | |||
| 6d90a47c24 | |||
| 03ee337e28 | |||
| 48ffd7e49b | |||
| 8df94bca26 | |||
| d2aced396f | |||
| 4e93722ba5 | |||
| 33a5996bee | |||
| 90475d4130 | |||
| 8e984e609b | |||
| b48502c34a | |||
| 978992057a | |||
| ed0fb8dd64 | |||
| 828bc89890 | |||
| b8bf4f88cc | |||
| f74587376e | |||
| a135196cb5 | |||
| cfdcb573de | |||
| f17215f236 | |||
| 5e60614588 | |||
| e385049652 | |||
| ef295e0994 | |||
| c3382a422d | |||
| 5d47e6d291 | |||
| 957ba6c72c | |||
| 4b551ccc31 | |||
| 9dc1faee6f | |||
| b998833371 | |||
| 13cd68707e | |||
| f355b9471a | |||
| a64af5f9cf | |||
| 7182391241 | |||
| 28ea9abccd | |||
| 9f41400bd8 | |||
| 78c5754655 | |||
| 5145835c8a | |||
| 6b15e7ff02 | |||
| a65be48d36 | |||
| ac91f6e4c8 | |||
| 09b1ee882d | |||
| acf867a375 | |||
| dd2635a44d | |||
| 29c19c6372 | |||
| 01d6d7439f | |||
| 860395cb14 | |||
| b1a539235b | |||
| 403c169ddd | |||
| 8d79cd76f6 | |||
| 392a4d4766 | |||
| 55fba75fda | |||
| 36157bd53b | |||
| 52706cab7d | |||
| ae97f061e8 | |||
| e34d197dd0 | |||
| fdf41e05fc | |||
| ae74035ad5 | |||
| ac11bb56db | |||
| 5081546cdf | |||
| 9da8a9494d | |||
| 4373ed684a | |||
| def0e0d0f9 | |||
| 36e8658dad | |||
| 6c1b77d7d2 | |||
| 4640526e4b | |||
| c7692ab9b6 | |||
| 36fbbb9386 | |||
| ef11309399 | |||
| 6f2dd0fc01 | |||
| 623f0164c8 | |||
| 88b47099b1 | |||
| 659d2a0840 | |||
| 68950dba10 | |||
| 3e215ae8e8 | |||
| e7b8c672e0 | |||
| 2462850e2e | |||
| abb61f65cd | |||
| da32d59161 | |||
| 40b1c4f2ab | |||
| 55de887f87 | |||
| ffe3cb6ecd | |||
| 69c67a1636 | |||
| f181009fa5 | |||
| b6551da147 | |||
| 2afb2971da | |||
| 14ffbb8657 | |||
| fbe5ef873b | |||
| d6ee1dde74 | |||
| 288b40ad12 | |||
| 3a3296c340 | |||
| e664a3797e | |||
| 36418673db | |||
| 98e4a4a340 | |||
| bfbbb66747 | |||
| 1933b58f84 | |||
| 05dc80bb6d | |||
| 4d63bff214 | |||
| c5474f1ff6 | |||
| 7ad785fed9 | |||
| e66f242c2c |
@@ -0,0 +1,13 @@
|
||||
node_modules/
|
||||
server/node_modules/
|
||||
|
||||
# Bỏ qua cấu hình hệ thống và Git
|
||||
.git/
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
# Bỏ qua các file log và build
|
||||
*.log
|
||||
dist/
|
||||
build/
|
||||
out/
|
||||
@@ -1,2 +1,4 @@
|
||||
.env
|
||||
node_modules
|
||||
server/dist
|
||||
dist
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"continue.enableConsole": true
|
||||
"continue.enableConsole": true,
|
||||
"remote.autoForwardPortsFallback": 0
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
# To AI Agent: Implement Smart Date-Based Accordion Auto-Expansion and Smooth Viewport Auto-Scroll
|
||||
|
||||
## 1. Context & UI/UX Requirements
|
||||
We are enhancing the routing UX between `MemberDashboard.tsx` and `ItineraryTimeline.tsx` based on `image_cc31a4.png`.
|
||||
|
||||
### Functional Specifications:
|
||||
1. **Date-Matching Evaluation:** When a user clicks "Chi tiết hành trình" on a tour card, calculate if the current user system local date falls inside any Stage/Leg timeline block.
|
||||
2. **Auto-Expansion State:** On timeline page load, the matched Leg accordion must be expanded by default (`expandedStageId === leg.id`).
|
||||
3. **Smart Auto-Scroll Layout:** The viewport must smoothly auto-scroll so that the expanded Leg's title bar lands **exactly below the sticky navigation tab bar** ("Lộ trình", "Chi phí", etc.), making it fully visible at the top of the viewport without layout clipping.
|
||||
|
||||
---
|
||||
|
||||
## 2. Technical Architecture & Layout Constraints
|
||||
|
||||
- **The Sticky Header Challenge:** Since the top navigation tab bar uses sticky/fixed positioning, a naive `scrollIntoView({ block: 'start' })` will cause the Leg's title to crawl *underneath* the tabs, hiding it.
|
||||
- **The Solution:** We will inject a dynamic CSS scroll-margin-top parameter (`scroll-mt-[70px]` or matching header height) on each Leg container, and trigger a minor delayed layout effect pool using a React `setTimeout` to wait for the DOM accordion expansion reflow before pulling the scroll trigger.
|
||||
|
||||
---
|
||||
|
||||
## 3. Code Refactoring Blueprint
|
||||
|
||||
### Step 1: Update Navigation Payload Handler in Dashboard Component
|
||||
Ensure the `MemberDashboard.tsx` accurately packages the matched target identifier into the client route state bucket:
|
||||
|
||||
```typescript
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleNavigateToItinerary = (tour: any) => {
|
||||
let targetLegId = null;
|
||||
|
||||
if (tour?.legs && tour.legs.length > 0) {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
for (const leg of tour.legs) {
|
||||
const rawStart = leg.startDate || leg.plannedStart || leg.date;
|
||||
const rawEnd = leg.endDate || leg.plannedEnd || leg.date;
|
||||
|
||||
if (rawStart) {
|
||||
const startBound = new Date(rawStart);
|
||||
startBound.setHours(0, 0, 0, 0);
|
||||
|
||||
const endBound = rawEnd ? new Date(rawEnd) : new Date(rawStart);
|
||||
endBound.setHours(23, 59, 59, 999);
|
||||
|
||||
if (today >= startBound && today <= endBound) {
|
||||
targetLegId = leg.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetLegId) {
|
||||
targetLegId = tour.legs[0].id; // Fallback to Chặng 1 if out of tour bounds
|
||||
}
|
||||
}
|
||||
|
||||
navigate(`/tour/${tour.id}`, {
|
||||
state: { defaultExpandedLegId: targetLegId, shouldScrollToTarget: true }
|
||||
});
|
||||
};
|
||||
|
||||
### Step 2: Inject Safe Identifiers and Scroll Margin inside ItineraryTimeline
|
||||
Locate the top-level outer container div of each Leg item inside the timeline loop (currentTour.legs.map). Assign a unique id and a scroll margin class utility:
|
||||
|
||||
{currentTour.legs.map((leg: any, legIdx: number) => (
|
||||
<div
|
||||
key={leg.id}
|
||||
id={`leg-anchor-node-${leg.id}`}
|
||||
/* CRITICAL: scroll-mt-[70px] leaves a 70px buffer space at the top.
|
||||
Adjust '70px' to match the exact height of your white Tour Navigation Tabs bar!
|
||||
*/
|
||||
className="scroll-mt-[70px] transition-all w-full mb-4"
|
||||
>
|
||||
{/* Accordion Header Title ("Chặng 2: Dạo chơi ở xứ hoa vàng...") */}
|
||||
<div className="flex items-center justify-between ...">
|
||||
...
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
### Step 3: Implement Lifecycle Interaction Trigger Engine
|
||||
Inside ItineraryTimeline.tsx, listen to the passed history route parameters. Set the state, then handle the async smooth scrolling action:
|
||||
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
const location = useLocation();
|
||||
const [expandedStageId, setExpandedStageId] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (location.state?.defaultExpandedLegId) {
|
||||
const targetId = location.state.defaultExpandedLegId;
|
||||
|
||||
// 1. Instantly trigger the accordion state layout expansion
|
||||
setExpandedStageId(targetId);
|
||||
|
||||
// 2. Schedule a deferred macro-task callback to allow DOM re-renders to finish
|
||||
if (location.state?.shouldScrollToTarget) {
|
||||
const scrollTimer = setTimeout(() => {
|
||||
const targetElement = document.getElementById(`leg-anchor-node-${targetId}`);
|
||||
if (targetElement) {
|
||||
targetElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'start'
|
||||
});
|
||||
}
|
||||
|
||||
// Clear history router state token flags to prevent repeating scroll on subsequent reload shifts
|
||||
window.history.replaceState({}, document.title);
|
||||
}, 150); // 150ms ensures smooth accordion height deployment transition finishes
|
||||
|
||||
return () => clearTimeout(scrollTimer);
|
||||
}
|
||||
} else if (currentTour?.legs && currentTour.legs.length > 0 && !expandedStageId) {
|
||||
setExpandedStageId(currentTour.legs[0].id);
|
||||
}
|
||||
}, [location.state, currentTour]);
|
||||
|
||||
## 4. Quality Control & Acceptance Verification
|
||||
[ ] Date Matching Accuracy: Set today's date context matching a target Leg configuration profile. Tap the transition interface button from dashboard. The page must route directly and expand the target container block node.
|
||||
|
||||
[ ] Flush Viewport Ceiling Test: The animated target header segment node must slide upwards smoothly. It must lock positions cleanly right below the lowest baseline layer shadow boundary of the Tab Controller without passing behind it.
|
||||
|
||||
[ ] State Cleanliness Check: Refreshing or navigating back and forth within the active Timeline panel after the initial landing should not lock or force layout views to keep jumping scroll heights automatically.
|
||||
@@ -0,0 +1,156 @@
|
||||
# Enhancement Summary: Tag Selection & Photo Filtering
|
||||
|
||||
## Overview
|
||||
Successfully enhanced the travel planning application with improved photo tagging UI and photo filtering capabilities on the explore map.
|
||||
|
||||
## Changes Implemented
|
||||
|
||||
### 1. Enhanced TagSelectModal Component ✅
|
||||
**File**: `frontend/src/components/TagSelectModal.tsx`
|
||||
|
||||
**Features Added**:
|
||||
- **Image Preview**: Shows the uploaded photo at the top of the modal (max-height: 192px, with rounded corners)
|
||||
- **Custom Tag Input**: Text input with "Nhập thẻ mới..." placeholder
|
||||
- **Add Custom Tags**: Button and Enter key support to add user-defined tags
|
||||
- **Remove Custom Tags**: Trash icon on hover to delete custom tags
|
||||
- **Visual Feedback**: Selected tags highlighted in different colors (blue for predefined, emerald for custom)
|
||||
- **Summary Section**: Displays count and list of all selected tags before confirmation
|
||||
|
||||
**UI Improvements**:
|
||||
- Sticky header and footer for easy access
|
||||
- Separate sections for predefined tags and custom input
|
||||
- Max-height with scrolling for long tag lists
|
||||
- Smooth animations and transitions
|
||||
|
||||
### 2. LandingPage Integration ✅
|
||||
**File**: `frontend/src/pages/LandingPage.tsx`
|
||||
|
||||
**Updates**:
|
||||
- Added `photoPreviewUrl` state for temporary preview image
|
||||
- Created object URL using `URL.createObjectURL()` when file is selected
|
||||
- Pass preview URL to TagSelectModal component
|
||||
- Proper cleanup with `URL.revokeObjectURL()` on modal close or after upload
|
||||
- Included custom tags in upload formData as JSON
|
||||
|
||||
**State Management**:
|
||||
```typescript
|
||||
const [photoPreviewUrl, setPhotoPreviewUrl] = useState<string>('');
|
||||
```
|
||||
|
||||
### 3. ExploreMap Photo Tag Filtering ✅
|
||||
**File**: `frontend/src/pages/ExploreMap.tsx`
|
||||
|
||||
**Features Added**:
|
||||
- **Photo Tag Filter State**: `selectedPhotoFilterTags` for tracking active filters
|
||||
- **Available Photo Tags**: `availablePhotoTags` computed from all public photos' metadata
|
||||
- **Enhanced Filter Dropdown**: Two-section filter UI:
|
||||
- **Tour Section (🧳 Chuyến đi)**: Existing tour tags (single selection)
|
||||
- **Photo Section (📸 Ảnh công khai)**: Photo tags from uploads (multiple selection)
|
||||
- **Filtering Logic**: `groupedPhotos` useMemo filters photos based on selected tags
|
||||
- **Dynamic Tag Population**: Photo tags automatically extracted from `photo.metadata.tags`
|
||||
|
||||
**Filtering Behavior**:
|
||||
- Multiple photo tags can be selected simultaneously
|
||||
- Photos matching ANY selected tag are displayed (OR logic)
|
||||
- "Tất cả" button clears photo filters
|
||||
- Filter is independent from tour tag filtering
|
||||
|
||||
## Technical Details
|
||||
|
||||
### Tag Storage
|
||||
- Backend stores tags in `photo.metadata.tags` as JSON array
|
||||
- No database schema changes required
|
||||
- Flexible for custom tags without pre-definition
|
||||
|
||||
### Frontend State Management
|
||||
```typescript
|
||||
// State
|
||||
const [selectedPhotoFilterTags, setSelectedPhotoFilterTags] = useState<string[]>([]);
|
||||
|
||||
// Computed
|
||||
const availablePhotoTags = React.useMemo(() => {
|
||||
const tagsSet = new Set<string>();
|
||||
publicPhotos.forEach(photo => {
|
||||
const tags = photo.metadata?.tags as string[] | undefined;
|
||||
if (Array.isArray(tags)) {
|
||||
tags.forEach(tag => tagsSet.add(tag));
|
||||
}
|
||||
});
|
||||
return Array.from(tagsSet).sort();
|
||||
}, [publicPhotos]);
|
||||
|
||||
// Filtered Results
|
||||
const groupedPhotos = React.useMemo(() => {
|
||||
let filteredPhotos = publicPhotos;
|
||||
if (selectedPhotoFilterTags.length > 0) {
|
||||
filteredPhotos = publicPhotos.filter((photo) => {
|
||||
const photoTags = photo.metadata?.tags as string[] | undefined;
|
||||
if (!Array.isArray(photoTags)) return false;
|
||||
return selectedPhotoFilterTags.some(tag => photoTags.includes(tag));
|
||||
});
|
||||
}
|
||||
// ... grouping and sorting logic
|
||||
}, [publicPhotos, selectedPhotoFilterTags]);
|
||||
```
|
||||
|
||||
## Testing Results
|
||||
|
||||
### Verified Functionality
|
||||
✅ Image preview displays in TagSelectModal
|
||||
✅ Custom tag input accepts user text
|
||||
✅ Custom tags can be added with button or Enter key
|
||||
✅ Custom tags can be removed with trash icon
|
||||
✅ All selected tags display in summary
|
||||
✅ Photo tag filtering works on ExploreMap
|
||||
✅ Multiple photo tags can be selected
|
||||
✅ "Tất cả" button clears filters
|
||||
✅ Docker build successful (0 errors)
|
||||
✅ All services running healthy
|
||||
|
||||
### Build Status
|
||||
- Frontend build: ✅ Success
|
||||
- Backend build: ✅ Success
|
||||
- Container deployment: ✅ All 4 services running
|
||||
- Browser testing: ✅ Filter dropdown functional
|
||||
|
||||
## User Workflow
|
||||
|
||||
### Photo Upload with Tags
|
||||
1. User clicks "Chụp ảnh" button
|
||||
2. Selects image from device
|
||||
3. Image is displayed in TagSelectModal preview
|
||||
4. User selects predefined tags from 11 categories
|
||||
5. User can add custom tags in textbox
|
||||
6. Confirms and photo is uploaded with all tags
|
||||
7. Tags stored in database for filtering
|
||||
|
||||
### Photo Discovery with Filtering
|
||||
1. User navigates to "Khám phá" (Explore)
|
||||
2. Clicks filter button to open dropdown
|
||||
3. Sees available photo tags from community uploads
|
||||
4. Selects one or more tags to filter
|
||||
5. Map refreshes showing only photos with selected tags
|
||||
6. Clear selection with "Tất cả" button to see all photos again
|
||||
|
||||
## Files Modified
|
||||
- ✅ `frontend/src/components/TagSelectModal.tsx` - Enhanced with preview and custom tags
|
||||
- ✅ `frontend/src/pages/LandingPage.tsx` - Integration with preview URL
|
||||
- ✅ `frontend/src/pages/ExploreMap.tsx` - Photo tag filtering implementation
|
||||
|
||||
## Browser Compatibility
|
||||
- Modern browsers with ES6+ support
|
||||
- Tested on latest Chrome/Firefox/Safari
|
||||
- Mobile responsive design with touch support
|
||||
|
||||
## Performance Considerations
|
||||
- Photo tag extraction done in useMemo (cached)
|
||||
- Filter operations are optimized with Set for uniqueness
|
||||
- Lazy filtering applied only to grouped photos
|
||||
- No additional API calls needed (uses existing photo data)
|
||||
|
||||
## Future Enhancements
|
||||
- Tag search/autocomplete in filter
|
||||
- Tag popularity sorting
|
||||
- Tag suggestions based on similar photos
|
||||
- User tag preferences/favorites
|
||||
- Tag analytics dashboard
|
||||
@@ -0,0 +1,83 @@
|
||||
# To AI Agent: Global Mobile Viewport Optimization Plan for `frontend/src/pages`
|
||||
|
||||
## 1. Context & Architectural Objective
|
||||
We are launching a comprehensive mobile responsive refactoring across all core application pages inside `frontend/src/pages/`. Currently, several layouts suffer from desktop-first design assumptions, leading to sideways horizontal scrolling, squished sidebars, text wrapping collisions, and clipped viewports on mobile browsers.
|
||||
|
||||
**Objective:** Inspect and refactor all page-level layout components to guarantee an impeccable, fluid mobile UX (screen widths under 640px) while preserving the current widescreen layout using Tailwind CSS responsive breakpoints (`sm:`, `md:`, `lg:`).
|
||||
|
||||
---
|
||||
|
||||
## 2. Core Mobile-Responsive Design Rules for Pages
|
||||
|
||||
When auditing and refactoring page containers, strictly enforce these implementation guardrails:
|
||||
|
||||
1. **Fluid Heights over Sticky Viewports:** Avoid hardcoding page heights to `h-screen`. On mobile browsers, the address bar dynamically expands and collapses, causing layout jumps. Use **`h-auto`** or the new dynamic viewport utilities **`h-dvh`** / **`min-h-dvh`** instead.
|
||||
2. **Horizontal Overflow Elimination:** Ensure the root wrapper of every page enforces `w-full overflow-x-hidden`. Any element causing a horizontal scrollbar must be converted to a flex-wrap, horizontal scroll grid, or dynamic stack.
|
||||
3. **Flex/Grid Stacking:** Multi-column dashboard layouts must stack vertically on mobile and separate into side-by-side structures on desktop:
|
||||
- Use `flex flex-col md:flex-row`
|
||||
- Use `grid grid-cols-1 md:grid-cols-3`
|
||||
4. **Touch Target & Spacing Downscaling:** Mobile views require higher breathing margins but smaller typography. Reduce text sizes (`text-base` ➔ `text-xs/sm`) and scale down paddings (`p-6` ➔ `p-3/4`) on mobile screens.
|
||||
|
||||
---
|
||||
|
||||
## 3. Targeted Page-by-Page Refactoring Guide
|
||||
|
||||
### 3.1. `MemberDashboard.tsx` (Trang chính / Danh sách Tour)
|
||||
- **The Issue:** The grid grid-cols-2 or grid-cols-3 arrangement squishes Tour Card components on small viewports.
|
||||
- **Refactor Spec:** - Change main wrapper grid to `grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`.
|
||||
- Force individual Tour Cards to occupy 100% width on mobile, stacking all actions ("Trò chuyện", "Chi tiết hành trình") into standard full-width rows or equal flex pairs (`flex-1`).
|
||||
|
||||
### 3.2. `ItineraryTimeline.tsx` (Trang quản lý Lộ trình Chi tiết)
|
||||
- **The Issue:** The sub-navigation tabs ribbon ("Lộ trình, Chi phí, Ảnh...") gets compressed, causing word overlapping. Timeline lines and node circles clip when left padding is too wide.
|
||||
- **Refactor Spec:**
|
||||
- Convert the sub-navigation menu container into a smooth horizontally scrollable ribbon on mobile:
|
||||
```jsx
|
||||
className="flex items-center gap-2 overflow-x-auto whitespace-nowrap scrollbar-none pb-2 md:overflow-x-visible md:whitespace-normal"
|
||||
```
|
||||
- Reduce the absolute left offset tracking of the timeline vertical axis indicator from `left-[32px]` down to a safe margin fitting tight spaces.
|
||||
|
||||
### 3.3. `PhotoGallery.tsx` / `GalleryPage.tsx` (Thư viện ảnh Tour)
|
||||
- **The Issue:** Widescreen image matrices cause layout bleeding or weird masonry columns.
|
||||
- **Refactor Spec:**
|
||||
- Force image grid wrappers to adopt `grid-cols-2` or `grid-cols-3` on mobile browsers instead of desktop 4-5 structures.
|
||||
- Ensure the modal lightboxes or floating overlays use full-width settings (`w-screen h-screen`) with zero perimeter radius limits.
|
||||
|
||||
---
|
||||
|
||||
## 4. Code Refactoring Reference Standard
|
||||
|
||||
### Layout Component Conversion Pattern:
|
||||
Apply this fluid adaptation standard on your root page return templates:
|
||||
|
||||
```jsx
|
||||
{/* ❌ BEFORE: RIGID DESKTOP-FIRST PAGE WRAPPER */}
|
||||
<div className="w-screen h-screen bg-slate-950 flex p-6 gap-6">
|
||||
<aside className="w-64 bg-slate-900">Sidebar</aside>
|
||||
<main className="flex-1 overflow-y-auto">Main Dashboard Content</main>
|
||||
</div>
|
||||
|
||||
{/* ✅ AFTER: MOBILE-FIRST FULLY RESPONSIVE LAYOUT SHEET */}
|
||||
<div className="w-full min-h-dvh bg-slate-950 flex flex-col md:flex-row p-3 sm:p-6 gap-4 sm:gap-6 overflow-x-hidden">
|
||||
|
||||
{/* Sticky Navigation or Drawer Menu on Mobile, Fixed Sidebar on Desktop */}
|
||||
<aside className="w-full md:w-64 shrink-0 bg-slate-900 rounded-xl p-4 md:sticky md:top-6 md:h-[calc(100vh-3rem)]">
|
||||
Sidebar/Menu Content
|
||||
</aside>
|
||||
|
||||
{/* Main Scrollable Core Content Space */}
|
||||
<main className="w-full flex-1 overflow-y-visible md:overflow-y-auto">
|
||||
<div className="space-y-4 max-w-7xl mx-auto">
|
||||
{/* Grid elements stack on mobile (1 col) and expand on desktop */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{/* Card components populate here */}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
## 5. Automated Verification Checklist for AI Agent
|
||||
|
||||
[ ] Zero Pixel Width Hardcodes: Scan all code blocks in frontend/src/pages/. Ensure no outer boundaries utilize structural fixed layouts like w-[1200px] or w-[800px] without a breakpoint utility prefix (e.g., lg:w-[1200px]).
|
||||
[ ] Viewport Axis Lock: Simulate viewport checks at 360px, 390px, and 412px widths. Verify that horizontal browser layout shifting is fully neutralized (window.scrollX === 0).
|
||||
[ ] Dynamic Viewport Heights Verification: Confirm that full-page dashboards replace static h-screen classes with h-auto or dynamic min-h-dvh settings to avoid layout bugs when the mobile address bar shifts.
|
||||
@@ -0,0 +1,132 @@
|
||||
# To AI Agent: Implement Clickable Google Maps Hyperlinks in PDF Export Table
|
||||
|
||||
## 1. Context & Feature Objective
|
||||
We are upgrading the PDF export functionality within the Yotrip Travel Planner application. Currently, the PDF generates a static table containing location names, addresses, and coordinates.
|
||||
**Objective:** Automatically turn every location row inside the PDF table into an interactive, clickable hyperlink. When a user clicks on the location cell in the generated PDF document, it must immediately open a browser tab navigating directly to that exact location on Google Maps.
|
||||
|
||||
---
|
||||
|
||||
## 2. Technical Architecture & Data Strategy
|
||||
|
||||
Because `jspdf-autotable` draws text onto a canvas layout, raw HTML tags like `<a>` will fail. We must implement a two-step rendering lifecycle:
|
||||
1. **Extraction & Styling State:** During the data loop, verify coordinates or address data. Generate a standard universal Google Maps search URL, save it into a coordinate-tracking index object, and transform the raw text cell into a styled cell object (Yale Blue text `#28536b` to mimic an online link).
|
||||
2. **Link Injection Layer:** Utilize the `didDrawCell` hook callback inside the `doc.autoTable` configuration to position a native invisible link window (`doc.link()`) precisely over the drawn dimensions of that specific location cell.
|
||||
|
||||
---
|
||||
|
||||
## 3. Code Refactoring Specification
|
||||
|
||||
### Step 1: Update Data Preparation Loop
|
||||
Locate the loop processing `currentTour.legs` inside your PDF generation code block. Initialize a temporary lookup map array named `pdfMapLinks` and refactor the item distribution logic as follows:
|
||||
|
||||
```typescript
|
||||
// Initialize an index mapping registry for hyperlinks before the loop execution
|
||||
const pdfMapLinks: { [key: number]: string } = {};
|
||||
|
||||
if (currentTour?.legs && currentTour.legs.length > 0) {
|
||||
currentTour.legs.forEach((leg: any, legIdx: number) => {
|
||||
const legName = leg.note || `Chặng ${legIdx + 1}`;
|
||||
const legLocations = (leg.locations || []).filter((loc: any) =>
|
||||
loc && (loc.plannedStart || loc.plannedEnd || loc.name)
|
||||
);
|
||||
|
||||
const startRow = globalRowIndex;
|
||||
|
||||
if (legLocations.length > 0) {
|
||||
legRowRanges[leg.id] = { start: startRow, count: legLocations.length };
|
||||
|
||||
legLocations.forEach((loc: any, locIdx: number) => {
|
||||
const isStartPoint = loc.plannedStart && new Date(loc.plannedStart).getTime() === 0;
|
||||
const timeSource = isStartPoint ? loc.plannedEnd : loc.plannedStart;
|
||||
const timeStr = timeSource ? formatDateTime(timeSource) : '';
|
||||
|
||||
const locName = loc.name || '';
|
||||
const addressStr = loc.address || '';
|
||||
const coordStr = loc.latitude && loc.longitude
|
||||
? `\n${loc.latitude}, ${loc.longitude}`
|
||||
: '';
|
||||
const locationText = [locName, addressStr, coordStr].filter(Boolean).join('\n');
|
||||
const noteText = loc.note || '';
|
||||
|
||||
// 1. Generate standard universal Google Maps URL query pattern
|
||||
let mapUrl = '';
|
||||
if (loc.latitude && loc.longitude) {
|
||||
// Absolute Precision using GPS coordinates
|
||||
mapUrl = `https://www.google.com/maps/search/?api=1&query=${loc.latitude},${loc.longitude}`;
|
||||
} else if (addressStr || locName) {
|
||||
// Text-search query fallback if GPS coordinates are missing
|
||||
mapUrl = `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(addressStr || locName)}`;
|
||||
}
|
||||
|
||||
// 2. Register current row array position to map lookup index
|
||||
const currentRowPosition = tableRows.length;
|
||||
if (mapUrl) {
|
||||
pdfMapLinks[currentRowPosition] = mapUrl;
|
||||
}
|
||||
|
||||
// 3. Convert raw string into custom styled autoTable Cell configuration object
|
||||
const locationCellObj = {
|
||||
content: locationText,
|
||||
// Apply custom link colors matching theme style #28536b (Yale Blue)
|
||||
styles: mapUrl ? { textColor: [40, 83, 107], fontStyle: 'bold' as const } : {}
|
||||
};
|
||||
|
||||
tableRows.push([
|
||||
stt++,
|
||||
timeStr,
|
||||
locIdx === 0 ? legName : '',
|
||||
locationCellObj, // Injected as cell structure object
|
||||
noteText
|
||||
]);
|
||||
globalRowIndex++;
|
||||
});
|
||||
} else {
|
||||
legRowRanges[leg.id] = { start: startRow, count: 1 };
|
||||
tableRows.push([
|
||||
stt++,
|
||||
'',
|
||||
legName,
|
||||
'Chưa có địa điểm trong chặng này',
|
||||
''
|
||||
]);
|
||||
globalRowIndex++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
### Step 2: Inject Coordinate-Based Overlay inside doc.autoTable
|
||||
Locate the core configuration module block where doc.autoTable({}) is invoked. Inject the didDrawCell event engine to deploy the link bounds:
|
||||
|
||||
doc.autoTable({
|
||||
head: [['STT', 'Thời gian', 'Chặng', 'Địa điểm', 'Ghi chú']],
|
||||
body: tableRows,
|
||||
theme: 'grid',
|
||||
|
||||
// HOOK HANDLER: Overlays active coordinate zones on top of native cells after writing
|
||||
didDrawCell: (data: any) => {
|
||||
// Target explicitly: body section only + column index 3 (Location Column)
|
||||
if (data.section === 'body' && data.column.index === 3) {
|
||||
const activeRowIndex = data.row.index;
|
||||
const targetMapUrl = pdfMapLinks[activeRowIndex];
|
||||
|
||||
if (targetMapUrl) {
|
||||
// Build active link container utilizing jsPDF coordinates framework
|
||||
data.doc.link(
|
||||
data.cell.x,
|
||||
data.cell.y,
|
||||
data.cell.width,
|
||||
data.cell.height,
|
||||
{ url: targetMapUrl }
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
styles: { font: 'Roboto' } // Retain existing styling structure
|
||||
});
|
||||
|
||||
## 4. Quality Control & Acceptance Criteria
|
||||
[ ] Visual Differentiation: Location text cells containing map URLs must render cleanly in bold dark-blue ([40, 83, 107]) while empty state texts stay muted.
|
||||
|
||||
[ ] Coordinate Precision: Clicking a location card possessing explicit coordinates (latitude, longitude) must directly map to those absolute markers instead of doing an inaccurate keyword address query.
|
||||
|
||||
[ ] Boundary Accuracy: The click targets must fit perfectly inside the grid cell borders. Clicking near the edges of column 3 must register properly, while clicking column 2 (Leg name) or column 4 (Notes) must remain non-reactive.
|
||||
@@ -0,0 +1,133 @@
|
||||
# Travel Planning - Multi-User Travel Itinerary Management System
|
||||
|
||||
A comprehensive travel planning application that enables collaborative itinerary planning, expense tracking, and photo sharing for travel groups.
|
||||
|
||||
## Features
|
||||
|
||||
- **Tour Management**: Create and manage travel tours with multiple legs (stages) and locations
|
||||
- **Multi-user Collaboration**: Invite friends to join tours with role-based access control
|
||||
- **Interactive Maps**: Visual tour planning with Leaflet.js integration
|
||||
- **Expense Tracking**: Automatic cost splitting with configurable adult/child discounts
|
||||
- **Photo Sharing**: Secure photo album with privacy controls (PUBLIC, TOUR_ONLY, PRIVATE)
|
||||
- **Real-time Navigation**: Live GPS tracking and route optimization using OSRM API
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Layer | Technology | Purpose |
|
||||
|-------|-----------|---------|
|
||||
| **Frontend** | React + Vite | Single Page Application with fast HMR |
|
||||
| | TailwindCSS | Utility-first CSS framework |
|
||||
| | Zustand | Lightweight state management |
|
||||
| | Leaflet.js | Interactive map rendering |
|
||||
| **Backend** | NestJS | Scalable Node.js framework |
|
||||
| | JWT | Authentication & authorization |
|
||||
| | Prisma ORM | Type-safe database access |
|
||||
| | PostgreSQL + PostGIS | Spatial database for geographic data |
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
travelplanning/
|
||||
├── backend/ # Backend API server
|
||||
│ ├── src/
|
||||
│ │ ├── auth/ # Authentication modules
|
||||
│ │ ├── main.ts # NestJS entry point
|
||||
│ │ └── v1/ # API v1 endpoints
|
||||
│ └── prisma/
|
||||
│ └── schema.prisma # Database schema
|
||||
├── frontend/ # React frontend
|
||||
│ └── src/
|
||||
│ ├── pages/ # Main pages
|
||||
│ ├── components/ # Reusable UI components
|
||||
│ ├── hooks/ # Custom React hooks
|
||||
│ └── store/ # Zustand stores
|
||||
├── docs/ # Documentation
|
||||
│ ├── ARCHITECTURE.md # System architecture
|
||||
│ └── UITourDesign.md # UI design specifications
|
||||
└── .env # Environment variables
|
||||
```
|
||||
|
||||
## Database Schema
|
||||
|
||||
The application uses PostgreSQL with Prisma ORM. Key models include:
|
||||
|
||||
- **User**: Registered users with admin capability
|
||||
- **Tour**: Travel itineraries with date ranges and participant management
|
||||
- **Leg**: Stages within a tour (ordered sequence)
|
||||
- **Location**: Geographic points with timing and status tracking
|
||||
- **Expense**: Cost tracking linked to legs/locations
|
||||
- **Photo**: Media storage with privacy controls
|
||||
- **TourParticipant**: Many-to-many relationship with role-based permissions
|
||||
|
||||
### User Roles
|
||||
|
||||
| Role | Permissions |
|
||||
|------|-------------|
|
||||
| OWNER | Full access to all features |
|
||||
| MANAGER | Can edit tour content and manage members |
|
||||
| MEMBER | View tour and participate, access financial data |
|
||||
| MEMBER_NO_FINANCE | View tour only, no financial access |
|
||||
| VIEWER_ONLY | Read-only access to itinerary and photos |
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Tours
|
||||
- `GET /api/v1/tours` - Get all public tours
|
||||
- `POST /api/v1/tours` - Create new tour
|
||||
- `GET /api/v1/tours/:id` - Get tour details
|
||||
- `PUT /api/v1/tours/:id` - Update tour
|
||||
|
||||
### Authentication
|
||||
- `POST /api/v1/auth/login` - User login
|
||||
- `POST /api/v1/auth/register` - User registration
|
||||
- `POST /api/v1/auth/promote-admin` - Admin role promotion (with secret key)
|
||||
|
||||
### Photos
|
||||
- `GET /api/v1/public-photos` - Get public photos
|
||||
- `POST /api/v1/tours/:id/photos` - Upload tour photos
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Prerequisites
|
||||
- Node.js 18+
|
||||
- PostgreSQL with PostGIS extension
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
cd frontend && npm install
|
||||
cd ../backend && npm install
|
||||
|
||||
# Set up database
|
||||
npx prisma migrate dev
|
||||
npx prisma generate
|
||||
|
||||
# Start development servers
|
||||
npm run dev # Frontend (Vite)
|
||||
npm run start:backend # Backend (NestJS)
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Create `.env` in the root directory:
|
||||
|
||||
```env
|
||||
DATABASE_URL="postgresql://user:password@localhost:5432/traveldb"
|
||||
JWT_SECRET="your-secret-key"
|
||||
```
|
||||
|
||||
## Mobile Optimization
|
||||
|
||||
The application is built mobile-first with support for:
|
||||
- Safe area insets for notch displays (iOS/Android)
|
||||
- Touch gestures for map interactions
|
||||
- Responsive layouts for all screen sizes
|
||||
- Device orientation and compass integration
|
||||
|
||||
## Documentation
|
||||
|
||||
See the `docs/` directory for detailed documentation:
|
||||
- [ARCHITECTURE.md](docs/ARCHITECTURE.md) - System architecture and data models
|
||||
- [UITourDesign.md](docs/UITourDesign.md) - UI design specifications
|
||||
@@ -0,0 +1,134 @@
|
||||
# To AI Agent: Audit Location Lock Bug and Refactor GPS Tracking into a Toggle Stateful Button
|
||||
|
||||
## 1. Context & Problem Statement
|
||||
Currently, in our travel planner application map engine (on pages like `TourNavigationPage.tsx`, `LocationNavigationModal.tsx`, or map utilities), the viewport is continuously forced to lock onto the user's live GPS position. This architecture severely damages mobile UX because:
|
||||
1. It prevents users from manually dragging, panning, or scouting other areas of the map terrain.
|
||||
2. There is no control interface to temporarily mute or disable live GPS tracking.
|
||||
|
||||
**Objective:** - Run a global audit across the entire codebase to locate functions driving this forced-center trap (e.g., custom hooks, `requestGpsPosition`, native geolocation callbacks, or reactive map state updates).
|
||||
- Refactor the logic so that live tracking is bound strictly to an independent toggle state button. The map must **ONLY** lock/re-center on the user's coordinates when this tracking toggle button is actively switched **ON**.
|
||||
|
||||
---
|
||||
|
||||
## 2. Phase 1: Codebase Audit Plan (Where to Search)
|
||||
|
||||
Scan the entire project repository (specifically `/frontend/src`) using code search patterns to intercept the lock mechanism. Target the following files and keywords:
|
||||
|
||||
### Key Target Files to Inspect:
|
||||
- `frontend/src/pages/TourNavigationPage.tsx`
|
||||
- `frontend/src/components/LocationNavigationModal.tsx`
|
||||
- Any custom hooks or contexts handling geography, such as `useGeolocation.ts`, `useMap.ts`, or generic map setup wrappers.
|
||||
|
||||
### Regex & Keyword Global Search Queries:
|
||||
- Search for native background watchers: `navigator.geolocation.watchPosition` or `navigator.geolocation.getCurrentPosition`
|
||||
- Search for custom map-centering loops: `requestGpsPosition`, `followUser`, `centerToUser`
|
||||
- Search for viewport mutation commands specific to our active map engine stack:
|
||||
- **Leaflet:** `.setView(`, `.panTo(`, `center={`
|
||||
- **Mapbox GL JS:** `.flyTo(`, `.easeTo(`, `.jumpTo(`
|
||||
|
||||
---
|
||||
|
||||
## 3. Phase 2: Technical Refactoring Blueprint
|
||||
|
||||
Once the tracking logic code blocks are isolated from Phase 1, implement the structural state safety rails below:
|
||||
|
||||
### Step 1: Initialize the Tracking State Guard
|
||||
Introduce a state hook controller (`isTrackingLocation`) to manage whether the view should actively mirror device coordinates:
|
||||
|
||||
```typescript
|
||||
// Add inside the map controller/page container component
|
||||
const [isTrackingLocation, setIsTrackingLocation] = useState(false);
|
||||
const watchIdRef = useRef<number | null>(null);
|
||||
|
||||
### Step 2: Encapsulate the Geolocation Watcher Handler
|
||||
Wrap your positioning tracking engine loop inside a conditional check governed directly by the state guard. Ensure that if the tracking state is disabled, the background watcher cleanly unmounts:
|
||||
|
||||
useEffect(() => {
|
||||
if (isTrackingLocation) {
|
||||
if (navigator.geolocation) {
|
||||
console.log("GPS Location Tracking engaged. Syncing viewport to center...");
|
||||
|
||||
watchIdRef.current = navigator.geolocation.watchPosition(
|
||||
(position) => {
|
||||
const { latitude, longitude, heading } = position.coords;
|
||||
|
||||
if (mapRef.current) {
|
||||
// ✅ CORRECTION: Viewport ONLY repositions center when tracking button is active
|
||||
mapRef.current.easeTo({
|
||||
center: [longitude, latitude],
|
||||
zoom: 16, // Lock to comfortable navigation zoom level
|
||||
duration: 600
|
||||
});
|
||||
}
|
||||
},
|
||||
(error) => console.error("GPS stream tracking lost:", error),
|
||||
{ enableHighAccuracy: true }
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Clean up tracking process instantly when toggled OFF
|
||||
if (watchIdRef.current !== null) {
|
||||
navigator.geolocation.clearWatch(watchIdRef.current);
|
||||
watchIdRef.current = null;
|
||||
console.log("GPS Location Tracking disabled. Map control released to user.");
|
||||
}
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (watchIdRef.current !== null) navigator.geolocation.clearWatch(watchIdRef.current);
|
||||
};
|
||||
}, [isTrackingLocation]);
|
||||
|
||||
### Step 3: Implement Gesture Detection (UX Safety Rail)
|
||||
If the user manually drags the screen while tracking is active, the tracking state must automatically toggle OFF so the viewport doesn't fight against the user's finger movements:
|
||||
|
||||
useEffect(() => {
|
||||
if (!mapRef.current) return;
|
||||
const map = mapRef.current;
|
||||
|
||||
const breakTrackingOnGesture = () => {
|
||||
if (isTrackingLocation) {
|
||||
console.log("User touch map interaction detected. Disengaging auto-center lock.");
|
||||
setIsTrackingLocation(false); // Automatically drop tracking flag on map pan/zoom
|
||||
}
|
||||
};
|
||||
|
||||
map.on('dragstart', breakTrackingOnGesture);
|
||||
map.on('zoomstart', breakTrackingOnGesture);
|
||||
map.on('movestart', breakTrackingOnGesture);
|
||||
|
||||
return () => {
|
||||
map.off('dragstart', breakTrackingOnGesture);
|
||||
map.off('zoomstart', breakTrackingOnGesture);
|
||||
map.off('movestart', breakTrackingOnGesture);
|
||||
};
|
||||
}, [isTrackingLocation]);
|
||||
|
||||
### Step 4: Render the UI Toggle Button UI Component
|
||||
Deploy a new independent floating button on top of the map canvas workspace (placed at bottom-24 right-6, just right above your custom Compass button layout):
|
||||
|
||||
{/* FLOATING LIVE GPS TRACKING CENTER LOCK BUTTON */}
|
||||
<button
|
||||
onClick={() => setIsTrackingLocation(!isTrackingLocation)}
|
||||
className={`absolute bottom-24 right-6 z-40 w-14 h-14 rounded-full border-2 flex items-center justify-center shadow-2xl transition-all active:scale-95 ${
|
||||
isTrackingLocation
|
||||
? 'bg-green-600 border-green-400 text-white animate-pulse'
|
||||
: 'bg-white dark:bg-slate-900 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-green-500'
|
||||
}`}
|
||||
title={isTrackingLocation ? "Tắt tự động định tâm vị trí" : "Bật tự động định tâm theo vị trí của bạn"}
|
||||
>
|
||||
{/* Replace Crosshair icon element with your active layout icon package asset */}
|
||||
<svg xmlns="[http://www.w3.org/2000/svg](http://www.w3.org/2000/svg)" className="w-7 h-7" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
## 4. Verification & Quality Acceptance Criteria
|
||||
|
||||
[ ] Code Erasure Verification: Confirm that old continuous loops or uncontrolled recursive .setView/.easeTo methods triggered instantly on map load are fully removed or properly contained inside the state block.
|
||||
|
||||
[ ] Default State Freedom: Upon opening the map page path, tracking must default to OFF. Users must be able to drag the map anywhere in the world without the screen snapped or yanked back to their physical house position.
|
||||
|
||||
[ ] Toggle Activation Centering: Pressing the new GPS tracking button must instantly engage the animation, center the map view directly on top of the user blue dot icon, and follow them smoothly if they move.
|
||||
|
||||
[ ] Manual Override Interception: Turn tracking ON. Drag the map manually with a finger gesture. Verify that the tracking button instantly changes style states back to deactivated and tracking shuts down cleanly.
|
||||
@@ -0,0 +1,518 @@
|
||||
# Plan: Build ứng dụng Android 11+ từ Codebase hiện tại
|
||||
|
||||
## Tổng quan
|
||||
|
||||
Codebase hiện tại là một **web app React + Vite** (frontend) và **NestJS** (backend) theo mô hình monorepo. Chiến lược được đề xuất là dùng **Capacitor.js** để đóng gói web app thành native Android APK/AAB mà **không cần viết lại code**, đồng thời bổ sung các tính năng native (camera, GPS, notifications...) qua Capacitor plugins.
|
||||
|
||||
---
|
||||
|
||||
## So sánh các lựa chọn
|
||||
|
||||
| Phương pháp | Ưu điểm | Nhược điểm | Phù hợp? |
|
||||
|---|---|---|---|
|
||||
| **Capacitor.js** | Tái sử dụng 100% React code, hỗ trợ Vite, ít học thêm | Cần build native mỗi lần release | ✅ **Phù hợp nhất** |
|
||||
| React Native | Performance tốt hơn, native feel | Phải viết lại toàn bộ UI/components | ❌ Tốn quá nhiều công |
|
||||
| PWA (Add to Home Screen) | Không cần build APK | Bị giới hạn API trình duyệt, không lên Google Play | ❌ Không phù hợp |
|
||||
| Cordova/PhoneGap | Tương tự Capacitor | Cũ hơn, ít được duy trì | ❌ Không nên dùng |
|
||||
|
||||
**→ Quyết định: Sử dụng [Capacitor.js](https://capacitorjs.com/)** (do Ionic team phát triển), hỗ trợ Android API 30+ (Android 11).
|
||||
|
||||
---
|
||||
|
||||
## Kiến trúc triển khai
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ Android APK / AAB │
|
||||
│ ┌─────────────────────────────────────────────┐ │
|
||||
│ │ Capacitor WebView │ │
|
||||
│ │ (Chứa toàn bộ frontend React/Vite) │ │
|
||||
│ └──────────────────┬──────────────────────────┘ │
|
||||
│ │ HTTPS API calls │
|
||||
└─────────────────────┼───────────────────────────────┘
|
||||
▼
|
||||
┌────────────────────────┐
|
||||
│ NestJS Backend │
|
||||
│ (Deployed server / │
|
||||
│ localhost dev) │
|
||||
└────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Thông tin đã xác nhận
|
||||
|
||||
| Hạng mục | Quyết định |
|
||||
|---|---|
|
||||
| **Tên app** | YoTrip |
|
||||
| **App ID** | `com.yotrip.app` |
|
||||
| **Phát hành** | Google Play Store |
|
||||
| **Camera** | Native (chụp ảnh trực tiếp từ app) |
|
||||
| **Backend** | Docker trên Debian Homelab, proxy qua Nginx |
|
||||
| **Domain** | `yotrip.labz.io.vn` |
|
||||
| **DNS động** | Cloudflare DDNS |
|
||||
|
||||
---
|
||||
|
||||
## Điều kiện tiên quyết
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Trước khi thực hiện, cần chuẩn bị:
|
||||
> 1. **Java JDK 17+** — Android build tool yêu cầu
|
||||
> 2. **Android Studio** — để build APK, quản lý Android SDK và tạo/chạy Emulator
|
||||
> 3. **Android SDK** với API Level 30+ (Android 11 / API 30)
|
||||
> 4. **Android Virtual Device (AVD)** — tạo trong Android Studio AVD Manager
|
||||
> 5. **Domain + HTTPS cho Homelab** — bắt buộc cho Google Play (xem Phần Bên dưới)
|
||||
|
||||
> [!WARNING]
|
||||
> **Google Play bắt buộc HTTPS** — Android 9+ chặn HTTP rõ ràng mặc định. Homelab phải có SSL certificate hợp lệ (Let's Encrypt qua Nginx) và domain name trỏ vào homelab server.
|
||||
|
||||
> [!NOTE]
|
||||
> Trên emulator, `localhost` của **emulator** khác với `localhost` của máy tính. Phải dùng địa chỉ đặc biệt `10.0.2.2` thay thế khi test emulator (xem Phase 5b).
|
||||
|
||||
---
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
### Phase 1a: Cấu hình Backend Homelab (Docker + Nginx)
|
||||
|
||||
---
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Đây là điều kiện tiên quyết của toàn bộ kế hoạch. App không thể gửi lên Google Play nếu API chưa có HTTPS.
|
||||
|
||||
Homelab của bạn chạy Docker + Nginx là **đủ điều kiện kết nối**, nhưng cần đảm bảo:
|
||||
|
||||
#### Checklist Homelab/Nginx
|
||||
|
||||
| Yêu cầu | Mô tả |
|
||||
|---|---|
|
||||
| **Domain name** | `yotrip.labz.io.vn` — đã xác nhận |
|
||||
| **Port forwarding** | Router cài đặt forward port 80 và 443 vào Nginx server |
|
||||
| **SSL Certificate** | Let's Encrypt (miễn phí) qua Certbot: `certbot --nginx -d yotrip.labz.io.vn` |
|
||||
| **Nginx reverse proxy** | Forward HTTPS → NestJS container port 3001 |
|
||||
| **Docker Compose** | Backend container luôn restart khi Debian reboot |
|
||||
| **CORS** | Backend phải cho phép origin từ app Capacitor (có thể mở rộng `*` ban đầu) |
|
||||
| **IP động** | Dùng **Cloudflare DDNS** để giữ domain `yotrip.labz.io.vn` luôn trỏ đúng IP |
|
||||
|
||||
#### Mẫu cấu hình Nginx reverse proxy
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/sites-available/yotrip-api
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name yotrip.labz.io.vn;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/yotrip.labz.io.vn/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/yotrip.labz.io.vn/privkey.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3001;
|
||||
proxy_http_version 1.1;
|
||||
# Cần thiết cho WebSocket (Socket.IO)
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
# Redirect HTTP sang HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name yotrip.labz.io.vn;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
```
|
||||
|
||||
#### File cấu hình môi trường sẽ dùng
|
||||
|
||||
```env
|
||||
# frontend/.env.production
|
||||
VITE_API_BASE_URL=https://yotrip.labz.io.vn
|
||||
|
||||
# frontend/.env.emulator (test local)
|
||||
VITE_API_BASE_URL=http://10.0.2.2:3001
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 1b: Tập trung API URL trong Frontend
|
||||
|
||||
#### [MODIFY] [vite.config.ts](file:///home/locpham/travelplanning/frontend/vite.config.ts)
|
||||
- Dev proxy hiện tại trỏ về `http://localhost:3001` — chỉ hoạt động khi chạy trên browser máy tính.
|
||||
- Tạo biến môi trường `VITE_API_BASE_URL` để frontend biết trỏ đến đâu.
|
||||
|
||||
#### [NEW] `.env.production` trong `frontend/`
|
||||
```env
|
||||
VITE_API_BASE_URL=https://your-backend-server.com
|
||||
```
|
||||
|
||||
#### [NEW] `.env.development` trong `frontend/`
|
||||
```env
|
||||
# Dùng ngrok hoặc IP máy tính cho mobile dev
|
||||
VITE_API_BASE_URL=http://192.168.x.x:3001
|
||||
```
|
||||
|
||||
#### [MODIFY] Toàn bộ các file gọi `/api/v1/...`
|
||||
- Thay `fetch('/api/v1/...')` bằng `fetch(\`${import.meta.env.VITE_API_BASE_URL}/api/v1/...\`)`
|
||||
- **Ưu tiên**: Tạo một file `src/lib/api.ts` (helper) để tập trung URL, tránh sửa từng file.
|
||||
|
||||
```typescript
|
||||
// src/lib/api.ts
|
||||
export const API_BASE = import.meta.env.VITE_API_BASE_URL || '';
|
||||
|
||||
export const apiFetch = (path: string, options?: RequestInit) =>
|
||||
fetch(`${API_BASE}${path}`, options);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Tích hợp Capacitor
|
||||
|
||||
---
|
||||
|
||||
#### Cài đặt Capacitor vào frontend
|
||||
|
||||
```bash
|
||||
# Trong thư mục frontend/
|
||||
npm install @capacitor/core @capacitor/cli
|
||||
npx cap init "YoTrip" "com.yotrip.app" --web-dir dist
|
||||
npm install @capacitor/android
|
||||
npx cap add android
|
||||
```
|
||||
|
||||
#### [NEW] `frontend/capacitor.config.ts`
|
||||
```typescript
|
||||
import { CapacitorConfig } from '@capacitor/cli';
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'com.yotrip.app', // ✅ App ID chính thức
|
||||
appName: 'YoTrip', // ✅ Tên app
|
||||
webDir: 'dist',
|
||||
server: {
|
||||
// Production: không cần cấu hình, dùng VITE_API_BASE_URL trong build
|
||||
// Dev/Emulator: uncomment dòng dưới
|
||||
// url: 'http://10.0.2.2:3002',
|
||||
// cleartext: true,
|
||||
},
|
||||
android: {
|
||||
minSdkVersion: 30, // Android 11 (API 30)
|
||||
targetSdkVersion: 34, // Android 14
|
||||
buildOptions: {
|
||||
keystorePath: 'release-key.keystore',
|
||||
keystoreAlias: 'yotrip',
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
SplashScreen: {
|
||||
launchAutoHide: false,
|
||||
backgroundColor: '#0f172a',
|
||||
androidSplashResourceName: 'splash',
|
||||
},
|
||||
// Camera plugin config (bắt buộc vì app cần chụp ảnh)
|
||||
Camera: {
|
||||
presentationStyle: 'fullscreen',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: Android Project Setup
|
||||
|
||||
---
|
||||
|
||||
#### Build flow
|
||||
|
||||
```bash
|
||||
# Bước 1: Build React app thành static files
|
||||
npm run build -w frontend
|
||||
|
||||
# Bước 2: Copy static files vào Android project
|
||||
npx cap copy android
|
||||
|
||||
# Bước 3: Sync plugins và dependencies
|
||||
npx cap sync android
|
||||
|
||||
# Bước 4: Mở Android Studio để build APK/AAB
|
||||
npx cap open android
|
||||
```
|
||||
|
||||
#### [MODIFY] `android/app/src/main/AndroidManifest.xml` (tự sinh bởi Capacitor)
|
||||
Thêm các permissions cần thiết:
|
||||
```xml
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<!-- Android 11+ scoped storage -->
|
||||
<uses-permission android:name="android.permission.MANAGE_MEDIA" />
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: Native Plugins (**Bắt buộc**)
|
||||
|
||||
| Plugin | Mức độ | Mục đích | Package |
|
||||
|---|---|---|---|
|
||||
| `@capacitor/camera` | ✅ **Bắt buộc** | Chụp ảnh trực tiếp từ camera + gallery | `@capacitor/camera` |
|
||||
| `@capacitor/geolocation` | ✅ **Bắt buộc** | GPS thiết bị cho bản đồ | `@capacitor/geolocation` |
|
||||
| `@capacitor/splash-screen` | ✅ **Bắt buộc** | Màn hình khởi động | `@capacitor/splash-screen` |
|
||||
| `@capacitor/status-bar` | ✅ **Bắt buộc** | Màu status bar đồng bộ UI | `@capacitor/status-bar` |
|
||||
| `@capacitor/push-notifications` | 🔲 Tùy chọn | Thông báo bình luận, tour | `@capacitor/push-notifications` |
|
||||
| `@capacitor/network` | 🔲 Tùy chọn | Kiểm tra kết nối mạng | `@capacitor/network` |
|
||||
|
||||
#### Cách dùng Camera plugin trong code (thay thế input file)
|
||||
|
||||
```typescript
|
||||
// Thay thế <input type="file"> bằng Capacitor Camera API
|
||||
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||
|
||||
const takePhoto = async () => {
|
||||
const photo = await Camera.getPhoto({
|
||||
resultType: CameraResultType.DataUrl, // Hoặc Uri cho hiệu năng tốt hơn
|
||||
source: CameraSource.Prompt, // Hỏi: Camera hay Gallery?
|
||||
quality: 85,
|
||||
});
|
||||
// photo.dataUrl → upload lên backend
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 5: Điều chỉnh UI cho Mobile
|
||||
|
||||
Một số thành phần hiện tại đã có responsive CSS, nhưng cần kiểm tra thêm:
|
||||
|
||||
- **`PublicPhotoModal.tsx`**: Đã có kế hoạch fix mobile layout (từ plan cũ), cần implement trước khi build.
|
||||
- **`ExploreMap.tsx`**: Leaflet map cần đảm bảo touch events hoạt động (thường OK trên mobile).
|
||||
- **`TourDetailPage.tsx`**: Kiểm tra scroll behavior, fixed headers.
|
||||
- **Safe Area Insets**: Dùng `env(safe-area-inset-*)` cho các thiết bị có notch/dynamic island.
|
||||
|
||||
```css
|
||||
/* Thêm vào index.css */
|
||||
:root {
|
||||
--safe-top: env(safe-area-inset-top, 0px);
|
||||
--safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 5b: Test trên Android Emulator (AVD)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Đây là bước bắt buộc trước khi test trên thiết bị thật. Emulator giúp phát hiện lỗi layout, API call, và native permissions mà không cần thiết bị vật lý.
|
||||
|
||||
#### Tạo Android Virtual Device (AVD)
|
||||
1. Mở **Android Studio → Tools → Device Manager → Create Device**
|
||||
2. Chọn **Pixel 6** (hoặc tương đương) → chọn hệ thống **Android 11.0 (API 30)**
|
||||
3. Cấp RAM 2GB+, Storage 4GB+ cho emulator
|
||||
4. Khởi động emulator, đảm bảo hiện **"Emulator is running"**
|
||||
|
||||
#### Địa chỉ đặc biệt trong Emulator
|
||||
|
||||
```
|
||||
10.0.2.2 → Trỏ đến localhost (127.0.0.1) của máy tính host
|
||||
```
|
||||
|
||||
Khi chạy trong emulator, backend ở `localhost:3001` của máy tính phải được gọi bằng `10.0.2.2:3001`.
|
||||
|
||||
#### Cấu hình `capacitor.config.ts` cho Emulator Dev
|
||||
```typescript
|
||||
// Tạm thời uncomment khi test trên emulator
|
||||
server: {
|
||||
url: 'http://10.0.2.2:3002', // Trỏ đến Vite dev server trên máy host
|
||||
cleartext: true, // Cho phép HTTP (không dùng trong production)
|
||||
},
|
||||
```
|
||||
|
||||
Hoặc dùng biến môi trường `.env.emulator`:
|
||||
```env
|
||||
VITE_API_BASE_URL=http://10.0.2.2:3001
|
||||
```
|
||||
|
||||
#### Chạy app trên Emulator
|
||||
```bash
|
||||
# Bước 1: Đảm bảo emulator đang chạy
|
||||
adb devices
|
||||
# Phải thấy: emulator-5554 device
|
||||
|
||||
# Bước 2: Build & sync
|
||||
npm run build -w frontend
|
||||
npx cap copy android && npx cap sync android
|
||||
|
||||
# Bước 3: Chạy trực tiếp trên emulator
|
||||
npx cap run android
|
||||
# hoặc trong Android Studio: Run ▶ chọn emulator
|
||||
```
|
||||
|
||||
#### Checklist kiểm tra trên Emulator
|
||||
|
||||
| Chức năng | Test case | Kết quả mong đợi |
|
||||
|---|---|---|
|
||||
| Khởi động | Mở app | Splash screen → Landing page |
|
||||
| Đăng nhập | Nhập email/password | Vào ExploreMap |
|
||||
| Bản đồ | Zoom/pan trên emulator | Leaflet map hoạt động |
|
||||
| Upload ảnh | Chọn ảnh từ gallery giả lập | Ảnh được upload thành công |
|
||||
| Bình luận | Nhập & gửi bình luận | Hiện real-time qua WebSocket |
|
||||
| Safe area | Xoay màn hình | Layout không bị che |
|
||||
| Responsive | Portrait/Landscape | UI không bị vỡ |
|
||||
|
||||
---
|
||||
|
||||
### Phase 6: Test trên thiết bị Android thật
|
||||
|
||||
> [!NOTE]
|
||||
> Chỉ tiến hành Phase này sau khi toàn bộ Phase 5b đã pass. Thiết bị thật giúp phát hiện lỗi về hiệu năng, cảm biến thực tế, và hành vi network.
|
||||
|
||||
#### Kết nối thiết bị
|
||||
```bash
|
||||
# Bật Developer Mode + USB Debugging trên điện thoại
|
||||
# Cắm cáp USB → xác nhận "Allow USB Debugging"
|
||||
adb devices
|
||||
# Phải thấy: <serial_number> device
|
||||
```
|
||||
|
||||
#### Cấu hình backend cho thiết bị thật
|
||||
Thiết bị thật phải dùng IP LAN hoặc ngrok (không thể dùng `10.0.2.2`):
|
||||
```bash
|
||||
# Tùy chọn A: Dùng IP LAN (điện thoại và máy tính cùng WiFi)
|
||||
VITE_API_BASE_URL=http://192.168.x.x:3001
|
||||
|
||||
# Tùy chọn B: Dùng ngrok (tiện hơn, không cần cùng mạng)
|
||||
ngrok http 3001
|
||||
# → VITE_API_BASE_URL=https://xxxx.ngrok-free.app
|
||||
```
|
||||
|
||||
#### Cài debug APK lên thiết bị thật
|
||||
```bash
|
||||
# Build debug APK
|
||||
cd frontend/android && ./gradlew assembleDebug
|
||||
|
||||
# Cài APK lên thiết bị
|
||||
adb install app/build/outputs/apk/debug/app-debug.apk
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 7: Ký APK và phát hành
|
||||
|
||||
#### Debug build (dev testing)
|
||||
```bash
|
||||
cd android && ./gradlew assembleDebug
|
||||
# Output: android/app/build/outputs/apk/debug/app-debug.apk
|
||||
```
|
||||
|
||||
#### Release build (production)
|
||||
```bash
|
||||
# Tạo keystore lần đầu
|
||||
keytool -genkey -v -keystore release-key.keystore -alias yotrip \
|
||||
-keyalg RSA -keysize 2048 -validity 10000
|
||||
|
||||
# Build release
|
||||
cd android && ./gradlew bundleRelease
|
||||
# Output: .aab file để upload Google Play
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Checklist thực hiện
|
||||
|
||||
```
|
||||
Phase 1 - Backend URL
|
||||
[ ] Tạo file src/lib/api.ts (centralised fetch helper)
|
||||
[ ] Refactor tất cả fetch('/api/v1/...) sang apiFetch()
|
||||
[ ] Tạo .env.production với VITE_API_BASE_URL
|
||||
[ ] Tạo .env.emulator với VITE_API_BASE_URL=http://10.0.2.2:3001
|
||||
|
||||
Phase 2 - Capacitor Setup
|
||||
[ ] npm install @capacitor/core @capacitor/cli @capacitor/android
|
||||
[ ] npx cap init với App ID và tên app
|
||||
[ ] Tạo capacitor.config.ts
|
||||
[ ] npx cap add android
|
||||
|
||||
Phase 3 - Build & Sync
|
||||
[ ] npm run build -w frontend (kiểm tra không có lỗi TypeScript)
|
||||
[ ] npx cap copy android && npx cap sync android
|
||||
[ ] Cấu hình AndroidManifest.xml với permissions
|
||||
|
||||
Phase 4 - Native Plugins
|
||||
[ ] Cài @capacitor/geolocation (thay navigator.geolocation)
|
||||
[ ] Cài @capacitor/camera (upload ảnh từ điện thoại)
|
||||
[ ] Cài @capacitor/splash-screen, @capacitor/status-bar
|
||||
|
||||
Phase 5 - Mobile UI Polish
|
||||
[ ] Implement mobile layout fixes cho PublicPhotoModal.tsx
|
||||
[ ] Kiểm tra safe-area-inset cho Android
|
||||
|
||||
Phase 5b - Test trên Android Emulator (AVD)
|
||||
[ ] Tạo AVD Android 11 (API 30) trong Android Studio
|
||||
[ ] Cấu hình capacitor.config.ts server.url = http://10.0.2.2:3002
|
||||
[ ] Khởi động emulator → adb devices xác nhận kết nối
|
||||
[ ] npx cap run android → kiểm tra app khởi động
|
||||
[ ] Kiểm tra toàn bộ checklist: Login, Map, Upload, Comment, SafeArea
|
||||
[ ] Sửa tất cả lỗi phát sinh trên emulator
|
||||
|
||||
Phase 6 - Test trên thiết bị Android 11 thật
|
||||
[ ] Bật Developer Mode + USB Debugging trên điện thoại
|
||||
[ ] adb devices xác nhận thiết bị kết nối
|
||||
[ ] Cấu hình VITE_API_BASE_URL = IP LAN hoặc ngrok
|
||||
[ ] Build debug APK → adb install
|
||||
[ ] Kiểm tra lại toàn bộ checklist trên thiết bị thật
|
||||
[ ] Kiểm tra performance, pin, cảm biến GPS thực tế
|
||||
|
||||
Phase 7 - Build Release
|
||||
[ ] Build debug APK để test
|
||||
[ ] Tạo keystore và build release AAB
|
||||
[ ] Chuẩn bị lên Google Play (nếu cần)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verification Plan
|
||||
|
||||
### Automated
|
||||
- `npm run build -w frontend` — không có lỗi TypeScript/build
|
||||
- `adb devices` — xác nhận emulator/thiết bị thật đang kết nối
|
||||
|
||||
### Stage 1: Test trên Android Emulator
|
||||
1. App khởi động không crash, hiện Landing page đúng.
|
||||
2. Đăng nhập / Đăng ký hoạt động (kết nối `10.0.2.2:3001`).
|
||||
3. Bản đồ Leaflet zoom/pan bằng cảm ứng mô phỏng.
|
||||
4. Upload ảnh từ gallery giả lập của emulator.
|
||||
5. Bình luận real-time qua WebSocket hoạt động.
|
||||
6. Layout không bị vỡ khi xoay màn hình (portrait/landscape).
|
||||
7. Safe-area-inset không bị che bởi status bar.
|
||||
|
||||
### Stage 2: Test trên thiết bị Android 11 thật
|
||||
1. Lặp lại toàn bộ Stage 1 trên thiết bị thật.
|
||||
2. GPS thực tế hoạt động và hiện đúng vị trí trên bản đồ.
|
||||
3. Camera native chụp và upload ảnh thành công.
|
||||
4. Performance mượt mà (scroll, animation không giật).
|
||||
5. WebSocket giữ kết nối ổn định trên mobile network (4G/WiFi).
|
||||
6. Kiểm tra pin consumption không bất thường.
|
||||
|
||||
---
|
||||
|
||||
## Các quyết định đã xác nhận
|
||||
|
||||
| Câu hỏi | Trả lời |
|
||||
|---|---|
|
||||
| Backend deploy ở đâu? | Docker trên Debian homelab, proxy qua Nginx |
|
||||
| Tên app và App ID? | `YoTrip` — `com.yotrip.app` |
|
||||
| Domain? | `yotrip.labz.io.vn` (Cloudflare DDNS) |
|
||||
| Phát hành? | Đưa lên **Google Play Store** |
|
||||
| Camera? | **Native camera** — chụp ảnh trực tiếp từ app |
|
||||
|
||||
> [!NOTE]
|
||||
> **Lưu ý quan trọng về Homelab + Google Play:**
|
||||
> - Homelab + Docker + Nginx là **đủ điều kiện kết nối** cho app Android.
|
||||
> - Domain `yotrip.labz.io.vn` dùng **Cloudflare DDNS** — IP homelab thay đổi sẽ được cập nhật tự động.
|
||||
> - **WebSocket (Socket.IO)** cần Nginx được cấu hình `proxy_set_header Upgrade` (xem Phase 1a).
|
||||
> - Certbot cấp SSL cho `yotrip.labz.io.vn`: `certbot --nginx -d yotrip.labz.io.vn`
|
||||
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
dist
|
||||
npm-debug.log
|
||||
.env
|
||||
.git
|
||||
.gitignore
|
||||
@@ -0,0 +1,38 @@
|
||||
FROM node:20-alpine AS base
|
||||
|
||||
# Install openssl for Prisma
|
||||
RUN apk add --no-cache openssl
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package*.json ./
|
||||
COPY prisma ./prisma/
|
||||
|
||||
# Development stage
|
||||
FROM base AS development
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npx prisma generate
|
||||
EXPOSE 3001
|
||||
CMD ["npm", "run", "start:dev"]
|
||||
|
||||
# Build stage for production
|
||||
FROM base AS build
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
RUN npm prune --production
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine AS production
|
||||
RUN apk add --no-cache openssl
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package*.json ./
|
||||
COPY --from=build /usr/src/app/node_modules ./node_modules
|
||||
COPY --from=build /usr/src/app/dist ./dist
|
||||
COPY --from=build /usr/src/app/prisma ./prisma
|
||||
|
||||
EXPOSE 3001
|
||||
CMD ["node", "dist/src/main.js"]
|
||||
@@ -0,0 +1,39 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const tourId = '84d84c21-c12b-4a18-9655-043c85f5c0c5';
|
||||
const ownerUserId = '5b2053bb-f523-4a11-817c-f47fef7322bb'; // owner@travel.com
|
||||
|
||||
// Check if owner@travel.com is already a participant
|
||||
const existing = await prisma.tourParticipant.findFirst({
|
||||
where: { tourId, userId: ownerUserId }
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
await prisma.tourParticipant.update({
|
||||
where: { id: existing.id },
|
||||
data: { role: 'OWNER' }
|
||||
});
|
||||
console.log('Updated existing participant to OWNER');
|
||||
} else {
|
||||
// Demote current owner to MEMBER or just keep them
|
||||
const result = await prisma.tourParticipant.create({
|
||||
data: {
|
||||
tourId,
|
||||
userId: ownerUserId,
|
||||
role: 'OWNER'
|
||||
}
|
||||
});
|
||||
console.log('Created new OWNER participant:', result);
|
||||
}
|
||||
|
||||
// Update tour createdById to ownerUserId
|
||||
await prisma.tour.update({
|
||||
where: { id: tourId },
|
||||
data: { createdById: ownerUserId }
|
||||
});
|
||||
console.log('Updated tour creator to owner@travel.com');
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => prisma.$disconnect());
|
||||
@@ -1,4 +1,8 @@
|
||||
declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
||||
export declare class JwtAuthGuard extends JwtAuthGuard_base {
|
||||
}
|
||||
declare const JwtAuthGuardNoAnonymous_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
||||
export declare class JwtAuthGuardNoAnonymous extends JwtAuthGuardNoAnonymous_base {
|
||||
handleRequest(err: any, user: any, info: any): any;
|
||||
}
|
||||
export {};
|
||||
|
||||
@@ -6,13 +6,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JwtAuthGuard = void 0;
|
||||
exports.JwtAuthGuardNoAnonymous = exports.JwtAuthGuard = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const passport_1 = require("@nestjs/passport");
|
||||
const common_2 = require("@nestjs/common");
|
||||
let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
|
||||
};
|
||||
exports.JwtAuthGuard = JwtAuthGuard;
|
||||
exports.JwtAuthGuard = JwtAuthGuard = __decorate([
|
||||
(0, common_1.Injectable)()
|
||||
], JwtAuthGuard);
|
||||
let JwtAuthGuardNoAnonymous = class JwtAuthGuardNoAnonymous extends (0, passport_1.AuthGuard)('jwt') {
|
||||
handleRequest(err, user, info) {
|
||||
if (err || !user) {
|
||||
throw err || new common_2.UnauthorizedException('Phiên làm việc không hợp lệ hoặc đã hết hạn');
|
||||
}
|
||||
if (user.isAnonymous) {
|
||||
throw new common_2.UnauthorizedException('Tài khoản khách không có quyền truy cập tính năng này. Vui lòng đăng ký tài khoản để tiếp tục.');
|
||||
}
|
||||
return user;
|
||||
}
|
||||
};
|
||||
exports.JwtAuthGuardNoAnonymous = JwtAuthGuardNoAnonymous;
|
||||
exports.JwtAuthGuardNoAnonymous = JwtAuthGuardNoAnonymous = __decorate([
|
||||
(0, common_1.Injectable)()
|
||||
], JwtAuthGuardNoAnonymous);
|
||||
//# sourceMappingURL=jwt-auth.guard.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"jwt-auth.guard.js","sourceRoot":"","sources":["../../../src/auth/jwt-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;CAAG,CAAA;AAAxC,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAA4B"}
|
||||
{"version":3,"file":"jwt-auth.guard.js","sourceRoot":"","sources":["../../../src/auth/jwt-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAC7C,2CAAuD;AAGhD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;CAAG,CAAA;AAAxC,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAA4B;AAI9C,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;IAC3D,aAAa,CAAC,GAAQ,EAAE,IAAS,EAAE,IAAS;QAC1C,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,GAAG,IAAI,IAAI,8BAAqB,CAAC,6CAA6C,CAAC,CAAC;QACxF,CAAC;QAGD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,IAAI,8BAAqB,CAAC,gGAAgG,CAAC,CAAC;QACpI,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAbY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;GACA,uBAAuB,CAanC"}
|
||||
@@ -5,8 +5,8 @@ export declare class JwtStrategy extends JwtStrategy_base {
|
||||
constructor(prisma: PrismaService);
|
||||
validate(payload: any): Promise<{
|
||||
id: string;
|
||||
email: string;
|
||||
passwordHash: string;
|
||||
email: string | null;
|
||||
passwordHash: string | null;
|
||||
name: string | null;
|
||||
phone: string | null;
|
||||
address: string | null;
|
||||
@@ -14,6 +14,7 @@ export declare class JwtStrategy extends JwtStrategy_base {
|
||||
createdAt: Date;
|
||||
isAdmin: boolean;
|
||||
isBlocked: boolean;
|
||||
isAnonymous: boolean;
|
||||
}>;
|
||||
}
|
||||
export {};
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"jwt.strategy.js","sourceRoot":"","sources":["../../../src/auth/jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmE;AACnE,+CAAoD;AACpD,+CAAoD;AACpD,gEAA4D;AAGrD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD,YAAoB,MAAqB;QACvC,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,cAAc;SACtD,CAAC,CAAC;QALe,WAAM,GAAN,MAAM,CAAe;IAMzC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAY;QACzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7C,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,GAAG,EAAE;SAC3B,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,8BAAqB,CAAC,sDAAsD,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AApBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAEiB,8BAAa;GAD9B,WAAW,CAoBvB"}
|
||||
{"version":3,"file":"jwt.strategy.js","sourceRoot":"","sources":["../../../src/auth/jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmE;AACnE,+CAAoD;AACpD,+CAAoD;AACpD,gEAA4D;AAGrD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD,YAAoB,MAAqB;QACvC,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,cAAc;SACtD,CAAC,CAAC;QALe,WAAM,GAAN,MAAM,CAAe;IAMzC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAY;QACzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7C,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,GAAG,EAAE;SAC3B,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,8BAAqB,CAAC,sDAAsD,CAAC,CAAC;QAC1F,CAAC;QAID,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAtBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAEiB,8BAAa;GAD9B,WAAW,CAsBvB"}
|
||||
@@ -6,6 +6,18 @@ import { ParticipantRole } from '@prisma/client';
|
||||
import { Reflector } from '@nestjs/core';
|
||||
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
||||
import { Cache } from 'cache-manager';
|
||||
export declare class CommentGateway implements OnGatewayConnection {
|
||||
server: Server;
|
||||
handleConnection(client: Socket): void;
|
||||
handleJoinTour(client: Socket, tourId: string): void;
|
||||
handleJoinPhoto(client: Socket, photoId: string): void;
|
||||
notifyNewComment(tourId: string, data: any): void;
|
||||
notifyNewPhotoComment(photoId: string, data: any): void;
|
||||
handleJoinUser(client: Socket, userId: string): void;
|
||||
notifyNewMessage(receiverId: string, data: any): void;
|
||||
notifyConnectionAccepted(requesterId: string, data: any): void;
|
||||
notifyJoinRequestAccepted(userId: string, data: any): void;
|
||||
}
|
||||
export declare const ROLES_KEY = "roles";
|
||||
export declare const Roles: (...roles: ParticipantRole[]) => import("@nestjs/common").CustomDecorator<string>;
|
||||
export declare class TourRoleGuard implements CanActivate {
|
||||
@@ -15,9 +27,9 @@ export declare class TourRoleGuard implements CanActivate {
|
||||
constructor(reflector: Reflector, prisma: PrismaService, cacheManager: Cache);
|
||||
canActivate(context: ExecutionContext): Promise<boolean>;
|
||||
}
|
||||
export declare class CommentGateway implements OnGatewayConnection {
|
||||
server: Server;
|
||||
handleConnection(client: Socket): void;
|
||||
handleJoinTour(client: Socket, tourId: string): void;
|
||||
notifyNewComment(tourId: string, data: any): void;
|
||||
export declare class EmailService {
|
||||
private transporter;
|
||||
constructor();
|
||||
sendOTP(email: string, otp: string): Promise<any>;
|
||||
sendTourInvitation(email: string, tourTitle: string, inviteLink: string): Promise<any>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
|
||||
> backend@0.0.1 start:dev
|
||||
> nest start --watch
|
||||
|
||||
[2J[3J[H[[90m10:46:05 PM[0m] Starting compilation in watch mode...
|
||||
|
||||
[[90m10:46:08 PM[0m] Found 0 errors. Watching for file changes.
|
||||
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[NestFactory] [39m[32mStarting Nest application...[39m
|
||||
--- [PRISMA CHECK] ---
|
||||
DATABASE_URL nhận được: ĐÃ ĐỌC THÀNH CÔNG ✔️
|
||||
----------------------
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[InstanceLoader] [39m[32mConfigHostModule dependencies initialized[39m[38;5;3m +40ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[InstanceLoader] [39m[32mJwtModule dependencies initialized[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[InstanceLoader] [39m[32mConfigModule dependencies initialized[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[InstanceLoader] [39m[32mCacheModule dependencies initialized[39m[38;5;3m +15ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[InstanceLoader] [39m[32mAppModule dependencies initialized[39m[38;5;3m +2ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[WebSocketsController] [39m[32mCommentGateway subscribed to the "joinTour" message[39m[38;5;3m +11ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[WebSocketsController] [39m[32mCommentGateway subscribed to the "joinPhoto" message[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mAppController {/api/v1}:[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1, GET} route[39m[38;5;3m +2ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mAuthController {/api/v1/auth}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/auth/convert-guest, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/auth/create-guest, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/auth/status, GET} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/auth/login, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/auth/signup/request, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/auth/signup/verify, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mPublicTourController {/api/v1/tours}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:id/public, GET} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mTourController {/api/v1/tours}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/locations, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/start-point, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/end-point, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/legs/batch, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/legs, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:id, PATCH} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:id, DELETE} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/explore, GET} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:id, GET} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/members, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/join-requests, GET} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/join-requests, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/join-requests/:requestId/accept, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/join-requests/:requestId/reject, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/members/:userId, DELETE} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/tours/:tourId/photos, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mUserController {/api/v1/users}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/users, GET} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/users/me/photos, GET} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/users/:id, PATCH} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/users/:id, DELETE} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/users/block/:id, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mRoutingController {/api/v1/routing}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/routing/optimize/:legId, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mLegController {/api/v1/legs}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/legs/:id, PATCH} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/legs/:id, DELETE} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mLocationController {/api/v1/locations}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/locations/:id, PATCH} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/locations/:id, DELETE} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mCommentController {/api/v1/locations}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/locations/:locationId/comments, GET} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/locations/:locationId/comments, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mPhotoController {/api/v1/photos}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/photos/upload-anonymous, POST} route[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/photos/:id, DELETE} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mPublicPhotoController {/api/v1/public-photos}:[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/public-photos, GET} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/public-photos/:photoId/comments, GET} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/public-photos/:photoId/comments, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RoutesResolver] [39m[32mAdminOtpController {/api/v1/admin/otp}:[39m[38;5;3m +1ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/admin/otp/send, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[RouterExplorer] [39m[32mMapped {/api/v1/admin/otp/verify, POST} route[39m[38;5;3m +0ms[39m
|
||||
[32m[Nest] 2108058 - [39m06/19/2026, 10:46:09 PM [32m LOG[39m [38;5;3m[NestApplication] [39m[32mNest application successfully started[39m[38;5;3m +16ms[39m
|
||||
🚀 Server is running on: http://localhost:3001
|
||||
[EmailService] ✅ Kết nối SMTP thành công. Sẵn sàng gửi mail.
|
||||
[WS] Client connected: sIV1IoQvXb-xaa9iAAAC
|
||||
[WS] Client sIV1IoQvXb-xaa9iAAAC joined room: photo_557913e6-fcb4-4dae-8cff-a6ff52da3386
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "backend",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"build": "nest build",
|
||||
"start:dev": "nest start --watch",
|
||||
"db:generate": "dotenv -e ../.env -- prisma generate --schema=prisma/schema.prisma",
|
||||
"db:migrate": "dotenv -e ../.env -- prisma migrate dev --schema=prisma/schema.prisma",
|
||||
@@ -21,6 +22,7 @@
|
||||
"dependencies": {
|
||||
"@nestjs/cache-manager": "^3.1.3",
|
||||
"@nestjs/common": "^11.1.27",
|
||||
"@nestjs/config": "^4.0.4",
|
||||
"@nestjs/core": "^11.1.27",
|
||||
"@nestjs/jwt": "^11.0.2",
|
||||
"@nestjs/passport": "^11.0.5",
|
||||
@@ -33,6 +35,9 @@
|
||||
"cache-manager": "^7.2.8",
|
||||
"cache-manager-redis-yet": "^5.1.5",
|
||||
"dotenv": "^17.4.2",
|
||||
"exifr": "^7.1.3",
|
||||
"heic-convert": "^2.1.0",
|
||||
"nodemailer": "^9.0.1",
|
||||
"passport": "^0.7.0",
|
||||
"passport-jwt": "^4.0.1",
|
||||
"pg": "^8.12.0",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Photo" DROP CONSTRAINT "Photo_tourId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Photo" ADD COLUMN "originalUrl" TEXT,
|
||||
ALTER COLUMN "tourId" DROP NOT NULL,
|
||||
ALTER COLUMN "imageUrl" DROP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "isAnonymous" BOOLEAN NOT NULL DEFAULT false,
|
||||
ALTER COLUMN "email" DROP NOT NULL,
|
||||
ALTER COLUMN "passwordHash" DROP NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Photo" ADD CONSTRAINT "Photo_tourId_fkey" FOREIGN KEY ("tourId") REFERENCES "Tour"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Comment" ADD COLUMN "photoId" TEXT,
|
||||
ALTER COLUMN "locationId" DROP NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_photoId_fkey" FOREIGN KEY ("photoId") REFERENCES "Photo"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Location" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "TourParticipant" ADD COLUMN "adultCount" INTEGER NOT NULL DEFAULT 1,
|
||||
ADD COLUMN "childCount" INTEGER NOT NULL DEFAULT 0;
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The primary key for the `TourParticipant` table will be changed. If it partially fails, the table could be left without primary key constraint.
|
||||
- A unique constraint covering the columns `[tourId,userId]` on the table `TourParticipant` will be added. If there are existing duplicate values, this will fail.
|
||||
- The required column `id` was added to the `TourParticipant` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "TourParticipant" DROP CONSTRAINT "TourParticipant_pkey",
|
||||
ADD COLUMN "displayName" TEXT,
|
||||
ADD COLUMN "id" TEXT;
|
||||
|
||||
UPDATE "TourParticipant" SET "id" = md5(random()::text);
|
||||
|
||||
ALTER TABLE "TourParticipant" ALTER COLUMN "id" SET NOT NULL,
|
||||
ALTER COLUMN "userId" DROP NOT NULL;
|
||||
|
||||
ALTER TABLE "TourParticipant" ADD CONSTRAINT "TourParticipant_pkey" PRIMARY KEY ("id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "TourParticipant_tourId_userId_key" ON "TourParticipant"("tourId", "userId");
|
||||
@@ -0,0 +1,21 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "TourInvitation" (
|
||||
"id" TEXT NOT NULL,
|
||||
"tourId" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"role" "ParticipantRole" NOT NULL DEFAULT 'MEMBER',
|
||||
"token" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"expiredAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "TourInvitation_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "TourInvitation_token_key" ON "TourInvitation"("token");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "TourInvitation_tourId_email_key" ON "TourInvitation"("tourId", "email");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourInvitation" ADD CONSTRAINT "TourInvitation_tourId_fkey" FOREIGN KEY ("tourId") REFERENCES "Tour"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,57 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "ConnectionStatus" AS ENUM ('PENDING', 'ACCEPTED', 'REJECTED');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "ConnectionType" AS ENUM ('FRIEND', 'FAMILY');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "UserConnection" (
|
||||
"id" TEXT NOT NULL,
|
||||
"requesterId" TEXT NOT NULL,
|
||||
"receiverId" TEXT NOT NULL,
|
||||
"status" "ConnectionStatus" NOT NULL DEFAULT 'PENDING',
|
||||
"type" "ConnectionType" NOT NULL DEFAULT 'FRIEND',
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "UserConnection_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "DirectMessage" (
|
||||
"id" TEXT NOT NULL,
|
||||
"senderId" TEXT NOT NULL,
|
||||
"receiverId" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "DirectMessage_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "UserConnection_requesterId_idx" ON "UserConnection"("requesterId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "UserConnection_receiverId_idx" ON "UserConnection"("receiverId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "UserConnection_requesterId_receiverId_key" ON "UserConnection"("requesterId", "receiverId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "DirectMessage_senderId_idx" ON "DirectMessage"("senderId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "DirectMessage_receiverId_idx" ON "DirectMessage"("receiverId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserConnection" ADD CONSTRAINT "UserConnection_requesterId_fkey" FOREIGN KEY ("requesterId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserConnection" ADD CONSTRAINT "UserConnection_receiverId_fkey" FOREIGN KEY ("receiverId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "DirectMessage" ADD CONSTRAINT "DirectMessage_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "DirectMessage" ADD CONSTRAINT "DirectMessage_receiverId_fkey" FOREIGN KEY ("receiverId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,31 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "DirectMessage" ADD COLUMN "attachmentUrl" TEXT,
|
||||
ADD COLUMN "latitude" DOUBLE PRECISION,
|
||||
ADD COLUMN "longitude" DOUBLE PRECISION;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "TourMessage" (
|
||||
"id" TEXT NOT NULL,
|
||||
"tourId" TEXT NOT NULL,
|
||||
"senderId" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"attachmentUrl" TEXT,
|
||||
"latitude" DOUBLE PRECISION,
|
||||
"longitude" DOUBLE PRECISION,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "TourMessage_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "TourMessage_tourId_idx" ON "TourMessage"("tourId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "TourMessage_senderId_idx" ON "TourMessage"("senderId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourMessage" ADD CONSTRAINT "TourMessage_tourId_fkey" FOREIGN KEY ("tourId") REFERENCES "Tour"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourMessage" ADD CONSTRAINT "TourMessage_senderId_fkey" FOREIGN KEY ("senderId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,73 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "WordFilter" (
|
||||
"id" TEXT NOT NULL,
|
||||
"word" TEXT NOT NULL,
|
||||
"replacement" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "WordFilter_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ModerationSetting" (
|
||||
"id" TEXT NOT NULL,
|
||||
"blockNsfw" BOOLEAN NOT NULL DEFAULT false,
|
||||
"blurFaces" BOOLEAN NOT NULL DEFAULT false,
|
||||
|
||||
CONSTRAINT "ModerationSetting_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "TourRating" (
|
||||
"id" TEXT NOT NULL,
|
||||
"tourId" TEXT NOT NULL,
|
||||
"targetUserId" TEXT NOT NULL,
|
||||
"raterUserId" TEXT NOT NULL,
|
||||
"honesty" INTEGER NOT NULL DEFAULT 5,
|
||||
"transparency" INTEGER NOT NULL DEFAULT 5,
|
||||
"enthusiasm" INTEGER NOT NULL DEFAULT 5,
|
||||
"cheerfulness" INTEGER NOT NULL DEFAULT 5,
|
||||
"seriousness" INTEGER NOT NULL DEFAULT 5,
|
||||
"planning" INTEGER NOT NULL DEFAULT 5,
|
||||
"survival" INTEGER NOT NULL DEFAULT 5,
|
||||
"averageScore" DOUBLE PRECISION NOT NULL DEFAULT 5.0,
|
||||
"comment" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "TourRating_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "TourShare" (
|
||||
"id" TEXT NOT NULL,
|
||||
"tourId" TEXT NOT NULL,
|
||||
"token" TEXT NOT NULL,
|
||||
"isEnabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "TourShare_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "WordFilter_word_key" ON "WordFilter"("word");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "TourRating_tourId_targetUserId_raterUserId_key" ON "TourRating"("tourId", "targetUserId", "raterUserId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "TourShare_tourId_key" ON "TourShare"("tourId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "TourShare_token_key" ON "TourShare"("token");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourRating" ADD CONSTRAINT "TourRating_tourId_fkey" FOREIGN KEY ("tourId") REFERENCES "Tour"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourRating" ADD CONSTRAINT "TourRating_targetUserId_fkey" FOREIGN KEY ("targetUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourRating" ADD CONSTRAINT "TourRating_raterUserId_fkey" FOREIGN KEY ("raterUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourShare" ADD CONSTRAINT "TourShare_tourId_fkey" FOREIGN KEY ("tourId") REFERENCES "Tour"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "BusinessReport" (
|
||||
"id" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"phone" TEXT,
|
||||
"email" TEXT,
|
||||
"address" TEXT,
|
||||
"latitude" DOUBLE PRECISION,
|
||||
"longitude" DOUBLE PRECISION,
|
||||
"reason" TEXT NOT NULL,
|
||||
"isBlacklisted" BOOLEAN NOT NULL DEFAULT false,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "BusinessReport_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
@@ -0,0 +1,49 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "ModerationSetting" ADD COLUMN "trashRetentionDays" INTEGER NOT NULL DEFAULT 30;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Photo" ADD COLUMN "deletedAt" TIMESTAMP(3),
|
||||
ADD COLUMN "isDeleted" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Tour" ADD COLUMN "deletedAt" TIMESTAMP(3),
|
||||
ADD COLUMN "isDeleted" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "TourNote" (
|
||||
"id" TEXT NOT NULL,
|
||||
"tourId" TEXT NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"isDeleted" BOOLEAN NOT NULL DEFAULT false,
|
||||
"deletedAt" TIMESTAMP(3),
|
||||
|
||||
CONSTRAINT "TourNote_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "RecommendedLocation" (
|
||||
"id" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"phone" TEXT,
|
||||
"email" TEXT,
|
||||
"address" TEXT,
|
||||
"latitude" DOUBLE PRECISION,
|
||||
"longitude" DOUBLE PRECISION,
|
||||
"description" TEXT NOT NULL,
|
||||
"stars" INTEGER NOT NULL DEFAULT 5,
|
||||
"isApproved" BOOLEAN NOT NULL DEFAULT false,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "RecommendedLocation_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourNote" ADD CONSTRAINT "TourNote_tourId_fkey" FOREIGN KEY ("tourId") REFERENCES "Tour"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "TourNote" ADD CONSTRAINT "TourNote_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Photo" ADD COLUMN "flaggedAt" TIMESTAMP(3),
|
||||
ADD COLUMN "flaggedReason" TEXT,
|
||||
ADD COLUMN "isFlagged" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -57,8 +57,8 @@ enum PrivacyLevel {
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
passwordHash String
|
||||
email String? @unique
|
||||
passwordHash String?
|
||||
name String?
|
||||
phone String?
|
||||
address String?
|
||||
@@ -66,6 +66,7 @@ model User {
|
||||
createdAt DateTime @default(now())
|
||||
isAdmin Boolean @default(false)
|
||||
isBlocked Boolean @default(false)
|
||||
isAnonymous Boolean @default(false)
|
||||
|
||||
createdTours Tour[] @relation("TourCreator")
|
||||
tourParticipations TourParticipant[]
|
||||
@@ -74,7 +75,14 @@ model User {
|
||||
uploadedPhotos Photo[]
|
||||
paidExpenses Expense[] @relation("ExpensePaidBy")
|
||||
comments Comment[]
|
||||
|
||||
sentConnections UserConnection[] @relation("ConnectionRequester")
|
||||
receivedConnections UserConnection[] @relation("ConnectionReceiver")
|
||||
sentMessages DirectMessage[] @relation("MessageSender")
|
||||
receivedMessages DirectMessage[] @relation("MessageReceiver")
|
||||
tourMessages TourMessage[]
|
||||
receivedRatings TourRating[] @relation("RatedUser")
|
||||
sentRatings TourRating[] @relation("RatingUser")
|
||||
tourNotes TourNote[]
|
||||
}
|
||||
|
||||
model Tour {
|
||||
@@ -98,6 +106,13 @@ model Tour {
|
||||
joinRequests JoinRequest[]
|
||||
legs Leg[]
|
||||
photos Photo[]
|
||||
invitations TourInvitation[]
|
||||
tourMessages TourMessage[]
|
||||
ratings TourRating[]
|
||||
share TourShare?
|
||||
notes TourNote[]
|
||||
isDeleted Boolean @default(false)
|
||||
deletedAt DateTime?
|
||||
}
|
||||
|
||||
model JoinRequest {
|
||||
@@ -117,14 +132,18 @@ model JoinRequest {
|
||||
}
|
||||
|
||||
model TourParticipant {
|
||||
id String @id @default(uuid())
|
||||
tourId String
|
||||
userId String
|
||||
userId String?
|
||||
role ParticipantRole @default(MEMBER)
|
||||
displayName String?
|
||||
adultCount Int @default(1)
|
||||
childCount Int @default(0)
|
||||
|
||||
tour Tour @relation(fields: [tourId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([tourId, userId])
|
||||
@@unique([tourId, userId])
|
||||
}
|
||||
|
||||
model Leg {
|
||||
@@ -161,6 +180,8 @@ model Location {
|
||||
expenses Expense[]
|
||||
photos Photo[]
|
||||
comments Comment[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Expense {
|
||||
@@ -188,18 +209,194 @@ model Photo {
|
||||
capturedAt DateTime @default(now())
|
||||
metadata Json?
|
||||
privacy PrivacyLevel @default(TOUR_ONLY)
|
||||
isFlagged Boolean @default(false)
|
||||
flaggedReason String?
|
||||
flaggedAt DateTime?
|
||||
|
||||
tour Tour? @relation(fields: [tourId], references: [id], onDelete: SetNull)
|
||||
location Location? @relation(fields: [locationId], references: [id], onDelete: SetNull)
|
||||
uploader User @relation(fields: [uploaderId], references: [id])
|
||||
comments Comment[]
|
||||
isDeleted Boolean @default(false)
|
||||
deletedAt DateTime?
|
||||
}
|
||||
|
||||
model Comment {
|
||||
id String @id @default(uuid())
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
locationId String
|
||||
location Location @relation(fields: [locationId], references: [id], onDelete: Cascade)
|
||||
locationId String?
|
||||
location Location? @relation(fields: [locationId], references: [id], onDelete: Cascade)
|
||||
photoId String?
|
||||
photo Photo? @relation(fields: [photoId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model TourInvitation {
|
||||
id String @id @default(uuid())
|
||||
tourId String
|
||||
email String
|
||||
role ParticipantRole @default(MEMBER)
|
||||
token String @unique
|
||||
createdAt DateTime @default(now())
|
||||
expiredAt DateTime
|
||||
tour Tour @relation(fields: [tourId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([tourId, email])
|
||||
}
|
||||
|
||||
enum ConnectionStatus {
|
||||
PENDING
|
||||
ACCEPTED
|
||||
REJECTED
|
||||
}
|
||||
|
||||
enum ConnectionType {
|
||||
FRIEND
|
||||
FAMILY
|
||||
}
|
||||
|
||||
model UserConnection {
|
||||
id String @id @default(uuid())
|
||||
requesterId String
|
||||
receiverId String
|
||||
status ConnectionStatus @default(PENDING)
|
||||
type ConnectionType @default(FRIEND)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
requester User @relation("ConnectionRequester", fields: [requesterId], references: [id], onDelete: Cascade)
|
||||
receiver User @relation("ConnectionReceiver", fields: [receiverId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([requesterId, receiverId])
|
||||
@@index([requesterId])
|
||||
@@index([receiverId])
|
||||
}
|
||||
|
||||
model DirectMessage {
|
||||
id String @id @default(uuid())
|
||||
senderId String
|
||||
receiverId String
|
||||
content String @db.Text
|
||||
attachmentUrl String?
|
||||
latitude Float?
|
||||
longitude Float?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
sender User @relation("MessageSender", fields: [senderId], references: [id], onDelete: Cascade)
|
||||
receiver User @relation("MessageReceiver", fields: [receiverId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([senderId])
|
||||
@@index([receiverId])
|
||||
}
|
||||
|
||||
model TourMessage {
|
||||
id String @id @default(uuid())
|
||||
tourId String
|
||||
senderId String
|
||||
content String @db.Text
|
||||
attachmentUrl String?
|
||||
latitude Float?
|
||||
longitude Float?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
tour Tour @relation(fields: [tourId], references: [id], onDelete: Cascade)
|
||||
sender User @relation(fields: [senderId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([tourId])
|
||||
@@index([senderId])
|
||||
}
|
||||
|
||||
model WordFilter {
|
||||
id String @id @default(uuid())
|
||||
word String @unique
|
||||
replacement String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model ModerationSetting {
|
||||
id String @id @default(uuid())
|
||||
blockNsfw Boolean @default(false)
|
||||
blurFaces Boolean @default(false)
|
||||
trashRetentionDays Int @default(30)
|
||||
}
|
||||
|
||||
model TourRating {
|
||||
id String @id @default(uuid())
|
||||
tourId String
|
||||
targetUserId String
|
||||
raterUserId String
|
||||
honesty Int @default(5)
|
||||
transparency Int @default(5)
|
||||
enthusiasm Int @default(5)
|
||||
cheerfulness Int @default(5)
|
||||
seriousness Int @default(5)
|
||||
planning Int @default(5)
|
||||
survival Int @default(5)
|
||||
averageScore Float @default(5.0)
|
||||
comment String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
tour Tour @relation(fields: [tourId], references: [id], onDelete: Cascade)
|
||||
targetUser User @relation("RatedUser", fields: [targetUserId], references: [id], onDelete: Cascade)
|
||||
raterUser User @relation("RatingUser", fields: [raterUserId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([tourId, targetUserId, raterUserId])
|
||||
}
|
||||
|
||||
model TourShare {
|
||||
id String @id @default(uuid())
|
||||
tourId String @unique
|
||||
token String @unique @default(uuid())
|
||||
isEnabled Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
tour Tour @relation(fields: [tourId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model BusinessReport {
|
||||
id String @id @default(uuid())
|
||||
type String // e.g. "USER", "RESTAURANT", "HOTEL", "HOMESTAY"
|
||||
name String
|
||||
phone String?
|
||||
email String?
|
||||
address String?
|
||||
latitude Float?
|
||||
longitude Float?
|
||||
reason String @db.Text
|
||||
isBlacklisted Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model TourNote {
|
||||
id String @id @default(uuid())
|
||||
tourId String
|
||||
tour Tour @relation(fields: [tourId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
title String
|
||||
content String @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
isDeleted Boolean @default(false)
|
||||
deletedAt DateTime?
|
||||
}
|
||||
|
||||
model RecommendedLocation {
|
||||
id String @id @default(uuid())
|
||||
type String // e.g. "RESTAURANT", "HOTEL", "HOMESTAY"
|
||||
name String
|
||||
phone String?
|
||||
email String?
|
||||
address String?
|
||||
latitude Float?
|
||||
longitude Float?
|
||||
description String @db.Text
|
||||
stars Int @default(5)
|
||||
isApproved Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { Pool } from 'pg';
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as path from 'path';
|
||||
|
||||
const envPath = path.resolve(process.cwd(), '..', '.env');
|
||||
dotenv.config({ path: envPath });
|
||||
|
||||
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
||||
const adapter = new PrismaPg(pool);
|
||||
const prisma = new PrismaClient({ adapter });
|
||||
|
||||
async function main() {
|
||||
const users = await prisma.user.findMany();
|
||||
console.log('USERS:', users);
|
||||
}
|
||||
|
||||
main().finally(() => pool.end());
|
||||
@@ -1,5 +1,23 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { UnauthorizedException } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {}
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {}
|
||||
|
||||
// Guard that rejects anonymous/guest users - used for dashboard and sensitive endpoints
|
||||
@Injectable()
|
||||
export class JwtAuthGuardNoAnonymous extends AuthGuard('jwt') {
|
||||
handleRequest(err: any, user: any, info: any) {
|
||||
if (err || !user) {
|
||||
throw err || new UnauthorizedException('Phiên làm việc không hợp lệ hoặc đã hết hạn');
|
||||
}
|
||||
|
||||
// Reject anonymous/temporary users
|
||||
if (user.isAnonymous) {
|
||||
throw new UnauthorizedException('Tài khoản khách không có quyền truy cập tính năng này. Vui lòng đăng ký tài khoản để tiếp tục.');
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
throw new UnauthorizedException('Người dùng không tồn tại hoặc phiên làm việc hết hạn');
|
||||
}
|
||||
|
||||
// Note: We allow anonymous users to pass JWT validation
|
||||
// Individual endpoints decide whether to accept anonymous users based on their guard
|
||||
return user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
async function test() {
|
||||
const loginRes = await fetch('http://localhost:3001/api/v1/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email: 'owner@travel.com', password: '123456' })
|
||||
});
|
||||
const loginData = await loginRes.json();
|
||||
|
||||
if (loginRes.ok) {
|
||||
const token = loginData.access_token;
|
||||
const tourId = '84d84c21-c12b-4a18-9655-043c85f5c0c5'; // Tour ID from seed
|
||||
const res = await fetch(`http://localhost:3001/api/v1/tours/${tourId}/members`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
},
|
||||
body: JSON.stringify({ displayName: 'Offline Member X', role: 'MEMBER' })
|
||||
});
|
||||
console.log('Add status:', res.status);
|
||||
const data = await res.json();
|
||||
console.log('Add response:', data);
|
||||
} else {
|
||||
console.error('Login failed:', loginData);
|
||||
}
|
||||
}
|
||||
|
||||
test().catch(console.error);
|
||||
@@ -0,0 +1,14 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const users = await prisma.user.findMany();
|
||||
console.log('--- Users in DB ---');
|
||||
console.log(users);
|
||||
|
||||
const participants = await prisma.tourParticipant.findMany();
|
||||
console.log('--- Tour Participants in DB ---');
|
||||
console.log(participants);
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => prisma.$disconnect());
|
||||
@@ -0,0 +1,17 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const tours = await prisma.tour.findMany({
|
||||
include: {
|
||||
participants: {
|
||||
include: {
|
||||
user: { select: { email: true, name: true } }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(JSON.stringify(tours, null, 2));
|
||||
}
|
||||
|
||||
main().finally(() => prisma.$disconnect());
|
||||
@@ -0,0 +1,36 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const tourId = '84d84c21-c12b-4a18-9655-043c85f5c0c5'; // Use existing tour ID from seed
|
||||
|
||||
console.log('Inserting first manual member...');
|
||||
try {
|
||||
const p1 = await prisma.tourParticipant.create({
|
||||
data: {
|
||||
tourId,
|
||||
role: 'MEMBER',
|
||||
displayName: 'Manual Member 1'
|
||||
}
|
||||
});
|
||||
console.log('Inserted:', p1);
|
||||
} catch (err) {
|
||||
console.error('Failed to insert first:', err);
|
||||
}
|
||||
|
||||
console.log('Inserting second manual member...');
|
||||
try {
|
||||
const p2 = await prisma.tourParticipant.create({
|
||||
data: {
|
||||
tourId,
|
||||
role: 'MEMBER',
|
||||
displayName: 'Manual Member 2'
|
||||
}
|
||||
});
|
||||
console.log('Inserted:', p2);
|
||||
} catch (err) {
|
||||
console.error('Failed to insert second:', err);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => prisma.$disconnect());
|
||||
@@ -0,0 +1,22 @@
|
||||
async function test() {
|
||||
const loginRes = await fetch('http://localhost:3001/api/v1/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email: 'photomember@travel.com', password: '123456' })
|
||||
});
|
||||
const loginData = await loginRes.json();
|
||||
|
||||
if (loginRes.ok) {
|
||||
const token = loginData.access_token;
|
||||
const usersRes = await fetch('http://localhost:3001/api/v1/users?q=owner@travel.com', {
|
||||
headers: { 'Authorization': `Bearer ${token}` }
|
||||
});
|
||||
console.log('Users status:', usersRes.status);
|
||||
const usersData = await usersRes.json();
|
||||
console.log('Users data:', usersData);
|
||||
} else {
|
||||
console.error('Login failed:', loginData);
|
||||
}
|
||||
}
|
||||
|
||||
test().catch(console.error);
|
||||
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 378 KiB |
|
Before Width: | Height: | Size: 322 KiB |
|
After Width: | Height: | Size: 868 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 645 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 994 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 844 KiB |
|
After Width: | Height: | Size: 408 KiB |
|
After Width: | Height: | Size: 422 KiB |
|
After Width: | Height: | Size: 265 KiB |
|
After Width: | Height: | Size: 662 KiB |
|
After Width: | Height: | Size: 522 KiB |
|
After Width: | Height: | Size: 644 KiB |
@@ -0,0 +1,73 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: yotrip-db
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: travel_db
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- pg_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d travel_db"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: yotrip-redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
target: development
|
||||
container_name: yotrip-backend
|
||||
command: >
|
||||
sh -c "npx prisma migrate dev --schema=prisma/schema.prisma && npm run start:dev"
|
||||
ports:
|
||||
- "3001:3001"
|
||||
volumes:
|
||||
- ./backend:/usr/src/app
|
||||
- /usr/src/app/node_modules
|
||||
environment:
|
||||
DATABASE_URL: "postgresql://postgres:password@postgres:5432/travel_db?schema=public"
|
||||
REDIS_URL: "redis://redis:6379"
|
||||
PORT: 3001
|
||||
ADMIN_SECRET_KEY: "yotrip_secret_admin_key"
|
||||
JWT_SECRET: "super-secret"
|
||||
FRONTEND_URL: "http://localhost:5173"
|
||||
NODE_ENV: development
|
||||
SMTP_HOST: "${SMTP_HOST}"
|
||||
SMTP_PORT: "${SMTP_PORT}"
|
||||
SMTP_SECURE: "${SMTP_SECURE}"
|
||||
SMTP_USER: "${SMTP_USER}"
|
||||
SMTP_PASS: "${SMTP_PASS}"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
target: development
|
||||
container_name: yotrip-frontend
|
||||
command: npm run dev -- --host 0.0.0.0
|
||||
ports:
|
||||
- "5173:5173"
|
||||
volumes:
|
||||
- ./frontend:/usr/src/app
|
||||
- /usr/src/app/node_modules
|
||||
environment:
|
||||
VITE_API_URL: "http://localhost:3001"
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
volumes:
|
||||
pg_data:
|
||||
@@ -0,0 +1,69 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: yotrip-db-prod
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: travel_db
|
||||
volumes:
|
||||
- pg_data_prod:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d travel_db"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: yotrip-redis-prod
|
||||
restart: always
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
target: production
|
||||
container_name: yotrip-backend-prod
|
||||
restart: always
|
||||
command: >
|
||||
sh -c "npx prisma migrate deploy --schema=prisma/schema.prisma && node dist/src/main.js"
|
||||
ports:
|
||||
- "3001:3001"
|
||||
volumes:
|
||||
- /mnt/storage/yotrip/uploads:/usr/src/app/uploads
|
||||
environment:
|
||||
DATABASE_URL: "postgresql://postgres:password@postgres:5432/travel_db?schema=public"
|
||||
REDIS_URL: "redis://redis:6379"
|
||||
PORT: 3001
|
||||
ADMIN_SECRET_KEY: "${ADMIN_SECRET_KEY}"
|
||||
JWT_SECRET: "super-secret"
|
||||
FRONTEND_URL: "${FRONTEND_URL}"
|
||||
NODE_ENV: production
|
||||
SMTP_HOST: "${SMTP_HOST}"
|
||||
SMTP_PORT: "${SMTP_PORT}"
|
||||
SMTP_SECURE: "${SMTP_SECURE}"
|
||||
SMTP_USER: "${SMTP_USER}"
|
||||
SMTP_PASS: "${SMTP_PASS}"
|
||||
TZ: "Asia/Ho_Chi_Minh"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
target: production
|
||||
args:
|
||||
- VITE_GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
||||
container_name: yotrip-frontend-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "3002:80"
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
volumes:
|
||||
pg_data_prod:
|
||||
@@ -0,0 +1,68 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: yotrip-db-prod
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: travel_db
|
||||
volumes:
|
||||
- pg_data_prod:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d travel_db"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: yotrip-redis-prod
|
||||
restart: always
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
target: production
|
||||
container_name: yotrip-backend-prod
|
||||
restart: always
|
||||
command: >
|
||||
sh -c "npx prisma migrate deploy --schema=prisma/schema.prisma && node dist/src/main.js"
|
||||
ports:
|
||||
- "3001:3001"
|
||||
volumes:
|
||||
- ./backend/uploads:/usr/src/app/uploads
|
||||
environment:
|
||||
DATABASE_URL: "postgresql://postgres:password@postgres:5432/travel_db?schema=public"
|
||||
REDIS_URL: "redis://redis:6379"
|
||||
PORT: 3001
|
||||
ADMIN_SECRET_KEY: "${ADMIN_SECRET_KEY}"
|
||||
JWT_SECRET: "super-secret"
|
||||
FRONTEND_URL: "${FRONTEND_URL}"
|
||||
NODE_ENV: production
|
||||
SMTP_HOST: "${SMTP_HOST}"
|
||||
SMTP_PORT: "${SMTP_PORT}"
|
||||
SMTP_SECURE: "${SMTP_SECURE}"
|
||||
SMTP_USER: "${SMTP_USER}"
|
||||
SMTP_PASS: "${SMTP_PASS}"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
target: production
|
||||
args:
|
||||
- VITE_GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
||||
container_name: yotrip-frontend-prod
|
||||
restart: always
|
||||
ports:
|
||||
- "3002:80"
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
volumes:
|
||||
pg_data_prod:
|
||||
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
dist
|
||||
npm-debug.log
|
||||
.env
|
||||
.git
|
||||
.gitignore
|
||||
@@ -0,0 +1,28 @@
|
||||
FROM node:22-alpine AS base
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
# Development stage
|
||||
FROM base AS development
|
||||
RUN npm install
|
||||
COPY . .
|
||||
EXPOSE 5173
|
||||
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
||||
|
||||
# Build stage for production
|
||||
FROM base AS build
|
||||
ARG VITE_GOOGLE_CLIENT_ID
|
||||
ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Production stage using Nginx
|
||||
FROM nginx:1.25-alpine AS production
|
||||
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,101 @@
|
||||
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
|
||||
|
||||
# Built application files
|
||||
*.apk
|
||||
*.aar
|
||||
*.ap_
|
||||
*.aab
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# Generated files
|
||||
bin/
|
||||
gen/
|
||||
out/
|
||||
# Uncomment the following line in case you need and you don't have the release build type files in your app
|
||||
# release/
|
||||
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
|
||||
# Android Studio Navigation editor temp files
|
||||
.navigation/
|
||||
|
||||
# Android Studio captures folder
|
||||
captures/
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/gradle.xml
|
||||
.idea/assetWizardSettings.xml
|
||||
.idea/dictionaries
|
||||
.idea/libraries
|
||||
# Android Studio 3 in .gitignore file.
|
||||
.idea/caches
|
||||
.idea/modules.xml
|
||||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
|
||||
.idea/navEditor.xml
|
||||
|
||||
# Keystore files
|
||||
# Uncomment the following lines if you do not want to check your keystore files in.
|
||||
#*.jks
|
||||
#*.keystore
|
||||
|
||||
# External native build folder generated in Android Studio 2.2 and later
|
||||
.externalNativeBuild
|
||||
.cxx/
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
# google-services.json
|
||||
|
||||
# Freeline
|
||||
freeline.py
|
||||
freeline/
|
||||
freeline_project_description.json
|
||||
|
||||
# fastlane
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
fastlane/readme.md
|
||||
|
||||
# Version control
|
||||
vcs.xml
|
||||
|
||||
# lint
|
||||
lint/intermediates/
|
||||
lint/generated/
|
||||
lint/outputs/
|
||||
lint/tmp/
|
||||
# lint/reports/
|
||||
|
||||
# Android Profiling
|
||||
*.hprof
|
||||
|
||||
# Cordova plugins for Capacitor
|
||||
capacitor-cordova-android-plugins
|
||||
|
||||
# Copied web assets
|
||||
app/src/main/assets/public
|
||||
|
||||
# Generated Config files
|
||||
app/src/main/assets/capacitor.config.json
|
||||
app/src/main/assets/capacitor.plugins.json
|
||||
app/src/main/res/xml/config.xml
|
||||
@@ -0,0 +1,2 @@
|
||||
/build/*
|
||||
!/build/.npmkeep
|
||||
@@ -0,0 +1,54 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
namespace "com.yotrip.app"
|
||||
compileSdk rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "com.yotrip.app"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
|
||||
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
flatDir{
|
||||
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
||||
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
||||
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
||||
implementation project(':capacitor-android')
|
||||
testImplementation "junit:junit:$junitVersion"
|
||||
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
||||
implementation project(':capacitor-cordova-android-plugins')
|
||||
}
|
||||
|
||||
apply from: 'capacitor.build.gradle'
|
||||
|
||||
try {
|
||||
def servicesJSON = file('google-services.json')
|
||||
if (servicesJSON.text) {
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
}
|
||||
} catch(Exception e) {
|
||||
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
||||
|
||||
android {
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_21
|
||||
targetCompatibility JavaVersion.VERSION_21
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
dependencies {
|
||||
implementation project(':capacitor-geolocation')
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (hasProperty('postBuildExtras')) {
|
||||
postBuildExtras()
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.getcapacitor.myapp;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("com.getcapacitor.app", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/title_activity_main"
|
||||
android:theme="@style/AppTheme.NoActionBarLaunch"
|
||||
android:launchMode="singleTask"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths"></meta-data>
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
<!-- Permissions -->
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.yotrip.app;
|
||||
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
|
||||
public class MainActivity extends BridgeActivity {}
|
||||
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<WebView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.9 KiB |