feat: modular domain driven boilerplate
This commit is contained in:
18
modules/identity/events/code.ts
Normal file
18
modules/identity/events/code.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { event } from "@valkyr/event-store";
|
||||
import z from "zod";
|
||||
|
||||
const CodeIdentitySchema = z.object({
|
||||
id: z.string(),
|
||||
});
|
||||
|
||||
export default [
|
||||
event.type("code:created").data(
|
||||
z.object({
|
||||
identity: CodeIdentitySchema,
|
||||
value: z.string(),
|
||||
}),
|
||||
),
|
||||
event.type("code:claimed"),
|
||||
];
|
||||
|
||||
export type CodeIdentity = z.infer<typeof CodeIdentitySchema>;
|
||||
21
modules/identity/events/identity.ts
Normal file
21
modules/identity/events/identity.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { AuditActorSchema } from "@platform/spec/audit/actor.ts";
|
||||
import { event } from "@valkyr/event-store";
|
||||
import z from "zod";
|
||||
|
||||
import { EmailSchema } from "../schemas/email.ts";
|
||||
import { NameSchema } from "../schemas/name.ts";
|
||||
import { RoleSchema } from "../schemas/role.ts";
|
||||
|
||||
export default [
|
||||
event.type("identity:created").meta(AuditActorSchema),
|
||||
event.type("identity:avatar:added").data(z.string()).meta(AuditActorSchema),
|
||||
event.type("identity:name:added").data(NameSchema).meta(AuditActorSchema),
|
||||
event.type("identity:email:added").data(EmailSchema).meta(AuditActorSchema),
|
||||
event.type("identity:role:added").data(RoleSchema).meta(AuditActorSchema),
|
||||
event.type("identity:strategy:email:added").data(z.string()).meta(AuditActorSchema),
|
||||
event.type("identity:strategy:passkey:added").meta(AuditActorSchema),
|
||||
event
|
||||
.type("identity:strategy:password:added")
|
||||
.data(z.object({ alias: z.string(), password: z.string() }))
|
||||
.meta(AuditActorSchema),
|
||||
];
|
||||
Reference in New Issue
Block a user