refactor(features): rename mock/payload/interface files per Lazar pattern
Convention now: <name>.repository.{ts,mock.ts,interface.ts}.
Renames .mock prefix to .mock suffix; drops .payload prefix from real
impls (canonical name = real impl); dot-separates the .repository
qualifier in interface filenames. Class names follow suit:
PayloadXRepository → XRepository; Mock* unchanged.
Refactor log: §1, §3
Spec: §9.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import "reflect-metadata";
|
||||
import { injectable } from "inversify";
|
||||
|
||||
import type { IUsersRepository } from "../../application/repositories/users.repository.interface";
|
||||
import type { User } from "../../entities/models/user";
|
||||
|
||||
const DEFAULT_SEED: User[] = [
|
||||
{ id: "1", username: "alice", passwordHash: "hashed_password_alice" },
|
||||
{ id: "2", username: "bob", passwordHash: "hashed_password_bob" },
|
||||
];
|
||||
|
||||
@injectable()
|
||||
export class MockUsersRepository implements IUsersRepository {
|
||||
private _users: User[];
|
||||
|
||||
constructor(initialUsers: User[] = DEFAULT_SEED) {
|
||||
this._users = [...initialUsers];
|
||||
}
|
||||
|
||||
async getUser(id: string): Promise<User | undefined> {
|
||||
return this._users.find((u) => u.id === id);
|
||||
}
|
||||
|
||||
async getUserByUsername(username: string): Promise<User | undefined> {
|
||||
return this._users.find((u) => u.username === username);
|
||||
}
|
||||
|
||||
async createUser(input: User): Promise<User> {
|
||||
this._users.push(input);
|
||||
return input;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user