|
28 | 28 | public class CareerResourceService { |
29 | 29 |
|
30 | 30 | private static final int MAX_PAGE_SIZE = 50; |
| 31 | + private static final int DEMO_MIN_RESOURCE_COUNT = 60; |
31 | 32 |
|
32 | 33 | private final CareerResourceRepository resourceRepository; |
33 | 34 | private final UserRepository userRepository; |
@@ -192,15 +193,43 @@ public void deleteResource(String email, java.util.UUID resourceId) { |
192 | 193 |
|
193 | 194 | @PostConstruct |
194 | 195 | public void seedStarterResources() { |
195 | | - if (resourceRepository.count() > 0) { |
196 | | - return; |
197 | | - } |
198 | | - |
199 | 196 | addSeedResource("Career Preparation Notes", "https://docs.google.com/document/d/1-25JrPUai6P7pjKk1g7mELpI0YUINS_NpjUk7lsMfyg/edit?tab=t.0#heading=h.kf8l3f8jftc2", "Guides & Study Docs"); |
200 | 197 | addSeedResource("Main Career Resources Folder", "https://drive.google.com/drive/folders/1ISp9GBv7ih1blEQOPYplD_idG1j0ibGq?usp=sharing", "Drive Folders & File Packs"); |
201 | 198 | addSeedResource("DSA Folder", "https://drive.google.com/drive/folders/1ei52Zc_cQe0rJK404M56BmEisUjnF6kN?usp=drive_link", "Drive Folders & File Packs"); |
202 | 199 | addSeedResource("21 Days React Study Plan", "https://thecodedose.notion.site/21-Days-React-Study-Plan-1988ff023cae48459bae8cb20cb75a67", "Structured Learning"); |
203 | 200 | addSeedResource("Opportunity Tracker Sheet", "https://docs.google.com/spreadsheets/d/1KBFiqJTaFY1164XtglKvn2vAofScCfGlkY-n54D2d14/edit?gid=584790886#gid=584790886", "Trackers & Opportunity Sheets"); |
| 201 | + |
| 202 | + seedDemoVolumeResources(); |
| 203 | + } |
| 204 | + |
| 205 | + private void seedDemoVolumeResources() { |
| 206 | + long currentCount = resourceRepository.count(); |
| 207 | + if (currentCount >= DEMO_MIN_RESOURCE_COUNT) { |
| 208 | + return; |
| 209 | + } |
| 210 | + |
| 211 | + String[][] templates = { |
| 212 | + {"React Interview Drill", "https://example.com/resources/react-interview-drill", "Interview Prep"}, |
| 213 | + {"DSA Patterns Workbook", "https://example.com/resources/dsa-patterns-workbook", "DSA"}, |
| 214 | + {"System Design Primer", "https://example.com/resources/system-design-primer", "System Design"}, |
| 215 | + {"Resume Bullet Bank", "https://example.com/resources/resume-bullet-bank", "Resume"}, |
| 216 | + {"Backend Fundamentals Roadmap", "https://example.com/resources/backend-fundamentals-roadmap", "Roadmaps"}, |
| 217 | + {"Frontend Fundamentals Roadmap", "https://example.com/resources/frontend-fundamentals-roadmap", "Roadmaps"}, |
| 218 | + {"Mock Interview Checklist", "https://example.com/resources/mock-interview-checklist", "Mock Interviews"}, |
| 219 | + {"Job Board Tracker", "https://example.com/resources/job-board-tracker", "Job Boards"}, |
| 220 | + {"Behavioral Question Matrix", "https://example.com/resources/behavioral-question-matrix", "Interview Prep"}, |
| 221 | + {"Portfolio Project Ideas", "https://example.com/resources/portfolio-project-ideas", "Portfolio"} |
| 222 | + }; |
| 223 | + |
| 224 | + long resourcesToAdd = DEMO_MIN_RESOURCE_COUNT - currentCount; |
| 225 | + for (int i = 0; i < resourcesToAdd; i++) { |
| 226 | + String[] template = templates[i % templates.length]; |
| 227 | + String title = template[0] + " #" + (i + 1); |
| 228 | + String url = template[1] + "?v=" + (i + 1); |
| 229 | + String category = template[2]; |
| 230 | + |
| 231 | + addSeedResource(title, url, category); |
| 232 | + } |
204 | 233 | } |
205 | 234 |
|
206 | 235 | private void addSeedResource(String title, String url, String category) { |
|
0 commit comments