Skip to content

Commit 8d99f3f

Browse files
committed
feat(fixtures): add initial admin user fixture
Creates a new data fixture file to seed an initial administrator user with the email '[email protected]'. This user is loaded into the in-memory repository on startup, providing a pre-existing privileged account for development and testing of the dashboard login flow. This is the correct, secure way to provision initial admin users, removing the need for insecure logic in the public API services.
1 parent 85bc8e9 commit 8d99f3f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/src/fixtures/user_fixtures.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import 'package:ht_shared/ht_shared.dart';
2+
3+
/// A list of initial user data to be loaded into the in-memory user repository.
4+
///
5+
/// This list includes a pre-configured administrator user, which is essential
6+
/// for accessing the dashboard in a development environment.
7+
final List<User> userFixtures = [
8+
// The initial administrator user.
9+
User(
10+
id: 'admin-user-id', // A fixed, predictable ID for the admin.
11+
12+
roles: const [UserRoles.standardUser, UserRoles.admin],
13+
createdAt: DateTime.now().toUtc(),
14+
),
15+
// Add other initial users for testing if needed.
16+
// Example: A standard user
17+
// User( ... ),
18+
];

0 commit comments

Comments
 (0)