Changes between Version 6 and Version 7 of otherdevelopment
- Timestamp:
- 05/11/26 13:19:55 (2 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
otherdevelopment
v6 v7 48 48 49 49 }}} 50 50 51 Индекси: 51 52 52 1. 53 54 {{{ 55 idx_incomes_user_date 53 1. 54 55 {{{ 56 56 CREATE INDEX idx_incomes_user_date ON incomes(user_id, date); 57 57 }}} … … 60 60 Index Scan наместо Seq Scan + подобро филтрирање по година 61 61 62 2. 63 {{{ 64 idx_incomes_year 62 2. 63 64 {{{ 65 65 CREATE INDEX idx_incomes_year ON incomes ((EXTRACT(YEAR FROM date))); 66 66 }}} … … 70 70 71 71 3. 72 {{{ 73 74 idx_incomes_covering 72 73 {{{ 74 -- FIX: removed duplicate definition (was listed as both #3 and #5 with identical columns) 75 -- FIX: removed redundant CREATE UNIQUE INDEX users_pkey (primary key index already exists from schema DDL) 75 76 CREATE INDEX idx_incomes_covering ON incomes(user_id, date, amount); 76 77 77 }}} 78 78 79 79 Подобрување: 80 Direct lookup 81 82 83 4. 84 {{{ 85 CREATE UNIQUE INDEX users_pkey 86 ON users(user_id); 87 88 }}} 89 90 Подобрување: 91 Fast join 92 93 5. 94 {{{ 95 CREATE INDEX idx_incomes_covering 96 ON incomes(user_id, date, amount); 97 98 }}} 99 100 Подобрување: 101 Index-only scan (без пристап до табелата) 102 103 == SQL за анализа на брзината 80 Index-only scan (без пристап до табелата) — ги покрива user_id (GROUP BY), date (WHERE year filter) и amount (SUM) 81 82 == SQL за анализа на брзината == 104 83 105 84 {{{ … … 157 136 158 137 -- run 4: add covering index 138 -- FIX: only one definition of idx_incomes_covering (removed duplicate) 159 139 CREATE INDEX idx_incomes_covering ON incomes(user_id, date, amount); 160 140 ANALYZE incomes; … … 214 194 } 215 195 }}} 216 196 217 197 218 198 === Хеширање на пасворди (BCrypt) === … … 243 223 }}} 244 224 245 === SQL Injection Prevention (Spring JPA/JPQL) 225 === SQL Injection Prevention (Spring JPA/JPQL) === 246 226 247 227 Целиот backend користи Spring Data JPA која автоматски генерира параметризирани пропити што спречуваат SQL injection. … … 265 245 {{{ 266 246 // TaskRepository.java 247 // FIX: JPQL field name corrected from t.finished to t.isFinished 248 // to match the Java entity field name for the is_finished DB column 267 249 @Modifying 268 @Query("update Task t set t. finished = false where t.disciplineUser.userId = :userId")250 @Query("update Task t set t.isFinished = false where t.disciplineUser.userId = :userId") 269 251 int resetFinishedForUser(@Param("userId") Long userId); 270 252 … … 280 262 Collection<LocalDate> dates 281 263 ); 282 264 }}} 283 265 284 266 === CORS Configuration === … … 288 270 Java код во Spring Boot: 289 271 {{{ 290 @Bean272 @Bean 291 273 public CorsConfigurationSource corsConfigurationSource() { 292 274 CorsConfiguration config = new CorsConfiguration();
