Changes between Version 6 and Version 7 of otherdevelopment


Ignore:
Timestamp:
05/11/26 13:19:55 (2 weeks ago)
Author:
233062
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • otherdevelopment

    v6 v7  
    4848
    4949}}}
     50
    5051Индекси:
    5152
    52 1.
    53 
    54 {{{
    55 idx_incomes_user_date
     531.
     54
     55{{{
    5656CREATE INDEX idx_incomes_user_date ON incomes(user_id, date);
    5757}}}
     
    6060Index Scan наместо Seq Scan + подобро филтрирање по година
    6161
    62 2. 
    63 {{{
    64 idx_incomes_year
     622.
     63
     64{{{
    6565CREATE INDEX idx_incomes_year ON incomes ((EXTRACT(YEAR FROM date)));
    6666}}}
     
    7070
    71713.
    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)
    7576CREATE INDEX idx_incomes_covering ON incomes(user_id, date, amount);
    76 
    7777}}}
    7878
    7979Подобрување:
    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 за анализа на брзината
     80Index-only scan (без пристап до табелата) — ги покрива user_id (GROUP BY), date (WHERE year filter) и amount (SUM)
     81
     82== SQL за анализа на брзината ==
    10483
    10584{{{
     
    157136
    158137-- run 4: add covering index
     138-- FIX: only one definition of idx_incomes_covering (removed duplicate)
    159139CREATE INDEX idx_incomes_covering ON incomes(user_id, date, amount);
    160140ANALYZE incomes;
     
    214194    }
    215195}}}
    216            
     196
    217197
    218198=== Хеширање на пасворди (BCrypt) ===
     
    243223}}}
    244224
    245 === SQL Injection Prevention (Spring JPA/JPQL)
     225=== SQL Injection Prevention (Spring JPA/JPQL) ===
    246226
    247227Целиот backend користи Spring Data JPA која автоматски генерира параметризирани пропити што спречуваат SQL injection.
     
    265245{{{
    266246// 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
    267249@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")
    269251int resetFinishedForUser(@Param("userId") Long userId);
    270252
     
    280262    Collection<LocalDate> dates
    281263);
    282 
     264}}}
    283265
    284266=== CORS Configuration ===
     
    288270Java код во Spring Boot:
    289271{{{
    290   @Bean
     272    @Bean
    291273    public CorsConfigurationSource corsConfigurationSource() {
    292274        CorsConfiguration config = new CorsConfiguration();