mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 10:09:35 +01:00
refactor: EntityDraft-Pattern auf Customer, Article und ProductCategory anwenden
- CustomerDraft / CustomerUpdateDraft eingeführt - ArticleDraft / ArticleUpdateDraft eingeführt - ProductCategoryDraft / ProductCategoryUpdateDraft eingeführt - Customer.create() nimmt jetzt CustomerDraft, gibt Result zurück - Customer.update(CustomerUpdateDraft) ersetzt 4× updateXxx(VO) - Article.create() nimmt jetzt ArticleDraft statt VOs - Article.update(ArticleUpdateDraft) ersetzt rename() + changeCategory() - ProductCategory.create() nimmt jetzt ProductCategoryDraft, gibt Result zurück - ProductCategory.update(ProductCategoryUpdateDraft) ersetzt rename() + updateDescription() - Use Cases bauen Draft aus Command, kein VO-Wissen im Application Layer - CreateCustomerCommand / UpdateCustomerCommand: int → Integer für paymentDueDays - CLAUDE.md: EntityDraft-Pattern-Dokumentation ergänzt
This commit is contained in:
parent
6b341f217b
commit
87123df2e4
30 changed files with 625 additions and 329 deletions
|
|
@ -59,7 +59,7 @@ VALUES (
|
|||
'admin-001',
|
||||
'admin',
|
||||
'admin@effigenix.com',
|
||||
'$2a$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewY5GyYKKHFw3zqm', -- "admin123"
|
||||
'$2a$12$SJmX80hUZoA66W77CX7cHeRw1TPscXD6S8HYEZfhJ5PxTfkbwbLdi', -- "admin123"
|
||||
NULL, -- Kein Branch = globaler Zugriff
|
||||
'ACTIVE',
|
||||
CURRENT_TIMESTAMP,
|
||||
|
|
@ -127,7 +127,33 @@ curl -X POST http://localhost:8080/api/users \
|
|||
}'
|
||||
```
|
||||
|
||||
## 6. Datenbank erkunden
|
||||
## 6. BCrypt-Hash generieren
|
||||
|
||||
Beim Anlegen von Seed-Daten (SQL-Migrations) werden BCrypt-Hashes benötigt. Da verschiedene Tools unterschiedliche Hashes erzeugen (gleiche Ausgabe, verschiedenes Salt – das ist gewollt), muss der Hash **mit Spring's BCryptPasswordEncoder** generiert werden, damit er zur App-Konfiguration passt.
|
||||
|
||||
> **Wichtig:** Niemals einen Hash aus einem anderen Tool (htpasswd, online-Generatoren etc.) in Seed-Daten verwenden – nur Spring-generierte Hashes verifizieren korrekt.
|
||||
|
||||
```bash
|
||||
# Hash für ein Passwort generieren (Strength 12 wie in der App konfiguriert)
|
||||
SPRING_CRYPTO=$(find ~/.m2/repository/org/springframework/security -name "spring-security-crypto-*.jar" | tail -1)
|
||||
COMMONS=$(find ~/.m2/repository/commons-logging -name "*.jar" | tail -1)
|
||||
|
||||
cat > /tmp/GenHash.java << 'EOF'
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
public class GenHash {
|
||||
public static void main(String[] args) throws Exception {
|
||||
String password = args.length > 0 ? args[0] : "admin123";
|
||||
BCryptPasswordEncoder enc = new BCryptPasswordEncoder(12);
|
||||
System.out.println(enc.encode(password));
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
javac -cp "$SPRING_CRYPTO:$COMMONS" /tmp/GenHash.java -d /tmp
|
||||
java -cp "/tmp:$SPRING_CRYPTO:$COMMONS" GenHash "meinPasswort"
|
||||
```
|
||||
|
||||
## 7. Datenbank erkunden
|
||||
|
||||
```bash
|
||||
# PostgreSQL CLI
|
||||
|
|
@ -141,7 +167,7 @@ SELECT * FROM role_permissions; -- Rollen-Permissions
|
|||
SELECT * FROM audit_logs ORDER BY timestamp DESC LIMIT 10; -- Letzte 10 Audit Logs
|
||||
```
|
||||
|
||||
## 7. Development Workflow
|
||||
## 8. Development Workflow
|
||||
|
||||
### Code-Änderungen testen
|
||||
|
||||
|
|
@ -166,7 +192,7 @@ mvn verify
|
|||
|
||||
Bereits in `pom.xml` enthalten - Code-Änderungen werden automatisch neu geladen.
|
||||
|
||||
## 8. Typische Entwicklungs-Szenarien
|
||||
## 9. Typische Entwicklungs-Szenarien
|
||||
|
||||
### Neuen User erstellen (via API)
|
||||
|
||||
|
|
@ -201,7 +227,7 @@ PUT /api/users/{userId}/password
|
|||
}
|
||||
```
|
||||
|
||||
## 9. Fehlersuche
|
||||
## 10. Fehlersuche
|
||||
|
||||
### Port 8080 bereits belegt
|
||||
```bash
|
||||
|
|
@ -227,7 +253,7 @@ mvn flyway:info
|
|||
mvn flyway:repair
|
||||
```
|
||||
|
||||
## 10. Nächste Schritte
|
||||
## 11. Nächste Schritte
|
||||
|
||||
- 📖 Lies [USER_MANAGEMENT.md](./USER_MANAGEMENT.md) für Details
|
||||
- 🧪 Schreibe Integration Tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue