harmadik gyakorlat

This commit is contained in:
magdo
2026-02-25 20:16:03 +01:00
parent a837f5ecba
commit ffca701b84
34 changed files with 3397 additions and 0 deletions
@@ -0,0 +1,33 @@
/**
* UpdateBlogCommand
* Blog módosítási command
*/
export class UpdateBlogCommand {
constructor(id, data) {
this.id = id;
this.title = data.title;
this.content = data.content;
this.published = data.published;
}
validate() {
const errors = [];
if (!this.id) {
errors.push('Blog ID is required');
}
if (this.title !== undefined && this.title.trim().length === 0) {
errors.push('Title cannot be empty');
}
if (this.content !== undefined && this.content.trim().length === 0) {
errors.push('Content cannot be empty');
}
return {
isValid: errors.length === 0,
errors
};
}
}