Skip to content

Commit 50e694e

Browse files
committed
feat: add content management events
- Added events for headlines - Added events for categories - Added events for sources
1 parent bf53ae4 commit 50e694e

File tree

1 file changed

+208
-0
lines changed

1 file changed

+208
-0
lines changed
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
part of 'content_management_bloc.dart';
2+
3+
sealed class ContentManagementEvent extends Equatable {
4+
const ContentManagementEvent();
5+
6+
@override
7+
List<Object?> get props => [];
8+
}
9+
10+
/// {@template content_management_tab_changed}
11+
/// Event to change the active content management tab.
12+
/// {@endtemplate}
13+
final class ContentManagementTabChanged extends ContentManagementEvent {
14+
/// {@macro content_management_tab_changed}
15+
const ContentManagementTabChanged(this.tab);
16+
17+
/// The new active tab.
18+
final ContentManagementTab tab;
19+
20+
@override
21+
List<Object?> get props => [tab];
22+
}
23+
24+
/// {@template load_headlines_requested}
25+
/// Event to request loading of headlines.
26+
/// {@endtemplate}
27+
final class LoadHeadlinesRequested extends ContentManagementEvent {
28+
/// {@macro load_headlines_requested}
29+
const LoadHeadlinesRequested({this.startAfterId, this.limit});
30+
31+
/// Optional ID to start pagination after.
32+
final String? startAfterId;
33+
34+
/// Optional maximum number of items to return.
35+
final int? limit;
36+
37+
@override
38+
List<Object?> get props => [startAfterId, limit];
39+
}
40+
41+
/// {@template create_headline_requested}
42+
/// Event to request creation of a new headline.
43+
/// {@endtemplate}
44+
final class CreateHeadlineRequested extends ContentManagementEvent {
45+
/// {@macro create_headline_requested}
46+
const CreateHeadlineRequested(this.headline);
47+
48+
/// The headline to create.
49+
final Headline headline;
50+
51+
@override
52+
List<Object?> get props => [headline];
53+
}
54+
55+
/// {@template update_headline_requested}
56+
/// Event to request update of an existing headline.
57+
/// {@endtemplate}
58+
final class UpdateHeadlineRequested extends ContentManagementEvent {
59+
/// {@macro update_headline_requested}
60+
const UpdateHeadlineRequested({required this.id, required this.headline});
61+
62+
/// The ID of the headline to update.
63+
final String id;
64+
65+
/// The updated headline data.
66+
final Headline headline;
67+
68+
@override
69+
List<Object?> get props => [id, headline];
70+
}
71+
72+
/// {@template delete_headline_requested}
73+
/// Event to request deletion of a headline.
74+
/// {@endtemplate}
75+
final class DeleteHeadlineRequested extends ContentManagementEvent {
76+
/// {@macro delete_headline_requested}
77+
const DeleteHeadlineRequested(this.id);
78+
79+
/// The ID of the headline to delete.
80+
final String id;
81+
82+
@override
83+
List<Object?> get props => [id];
84+
}
85+
86+
/// {@template load_categories_requested}
87+
/// Event to request loading of categories.
88+
/// {@endtemplate}
89+
final class LoadCategoriesRequested extends ContentManagementEvent {
90+
/// {@macro load_categories_requested}
91+
const LoadCategoriesRequested({this.startAfterId, this.limit});
92+
93+
/// Optional ID to start pagination after.
94+
final String? startAfterId;
95+
96+
/// Optional maximum number of items to return.
97+
final int? limit;
98+
99+
@override
100+
List<Object?> get props => [startAfterId, limit];
101+
}
102+
103+
/// {@template create_category_requested}
104+
/// Event to request creation of a new category.
105+
/// {@endtemplate}
106+
final class CreateCategoryRequested extends ContentManagementEvent {
107+
/// {@macro create_category_requested}
108+
const CreateCategoryRequested(this.category);
109+
110+
/// The category to create.
111+
final Category category;
112+
113+
@override
114+
List<Object?> get props => [category];
115+
}
116+
117+
/// {@template update_category_requested}
118+
/// Event to request update of an existing category.
119+
/// {@endtemplate}
120+
final class UpdateCategoryRequested extends ContentManagementEvent {
121+
/// {@macro update_category_requested}
122+
const UpdateCategoryRequested({required this.id, required this.category});
123+
124+
/// The ID of the category to update.
125+
final String id;
126+
127+
/// The updated category data.
128+
final Category category;
129+
130+
@override
131+
List<Object?> get props => [id, category];
132+
}
133+
134+
/// {@template delete_category_requested}
135+
/// Event to request deletion of a category.
136+
/// {@endtemplate}
137+
final class DeleteCategoryRequested extends ContentManagementEvent {
138+
/// {@macro delete_category_requested}
139+
const DeleteCategoryRequested(this.id);
140+
141+
/// The ID of the category to delete.
142+
final String id;
143+
144+
@override
145+
List<Object?> get props => [id];
146+
}
147+
148+
/// {@template load_sources_requested}
149+
/// Event to request loading of sources.
150+
/// {@endtemplate}
151+
final class LoadSourcesRequested extends ContentManagementEvent {
152+
/// {@macro load_sources_requested}
153+
const LoadSourcesRequested({this.startAfterId, this.limit});
154+
155+
/// Optional ID to start pagination after.
156+
final String? startAfterId;
157+
158+
/// Optional maximum number of items to return.
159+
final int? limit;
160+
161+
@override
162+
List<Object?> get props => [startAfterId, limit];
163+
}
164+
165+
/// {@template create_source_requested}
166+
/// Event to request creation of a new source.
167+
/// {@endtemplate}
168+
final class CreateSourceRequested extends ContentManagementEvent {
169+
/// {@macro create_source_requested}
170+
const CreateSourceRequested(this.source);
171+
172+
/// The source to create.
173+
final Source source;
174+
175+
@override
176+
List<Object?> get props => [source];
177+
}
178+
179+
/// {@template update_source_requested}
180+
/// Event to request update of an existing source.
181+
/// {@endtemplate}
182+
final class UpdateSourceRequested extends ContentManagementEvent {
183+
/// {@macro update_source_requested}
184+
const UpdateSourceRequested({required this.id, required this.source});
185+
186+
/// The ID of the source to update.
187+
final String id;
188+
189+
/// The updated source data.
190+
final Source source;
191+
192+
@override
193+
List<Object?> get props => [id, source];
194+
}
195+
196+
/// {@template delete_source_requested}
197+
/// Event to request deletion of a source.
198+
/// {@endtemplate}
199+
final class DeleteSourceRequested extends ContentManagementEvent {
200+
/// {@macro delete_source_requested}
201+
const DeleteSourceRequested(this.id);
202+
203+
/// The ID of the source to delete.
204+
final String id;
205+
206+
@override
207+
List<Object?> get props => [id];
208+
}

0 commit comments

Comments
 (0)