@frigear-nu/events 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/module.d.mts +78 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +52 -10
- package/dist/runtime/app/components/EventAdminAddonGroups.vue +2 -1
- package/dist/runtime/app/dashboard/MyNextTicket.d.vue.ts +3 -0
- package/dist/runtime/app/dashboard/MyNextTicket.vue +110 -0
- package/dist/runtime/app/dashboard/MyNextTicket.vue.d.ts +3 -0
- package/dist/runtime/app/grants/EventGrantField.d.vue.ts +15 -0
- package/dist/runtime/app/grants/EventGrantField.vue +87 -0
- package/dist/runtime/app/grants/EventGrantField.vue.d.ts +15 -0
- package/dist/runtime/app/pages/admin.vue +4 -1
- package/dist/runtime/app/tabs/Attendees.vue +33 -12
- package/dist/runtime/app/tabs/Details.vue +2 -1
- package/dist/runtime/app/tabs/Tickets.vue +4 -2
- package/dist/runtime/app/widgets/UpcomingEvents.d.vue.ts +4 -1
- package/dist/runtime/app/widgets/UpcomingEvents.vue +26 -14
- package/dist/runtime/app/widgets/UpcomingEvents.vue.d.ts +4 -1
- package/dist/runtime/app/widgets/UpcomingEventsStat.d.vue.ts +4 -1
- package/dist/runtime/app/widgets/UpcomingEventsStat.vue +11 -3
- package/dist/runtime/app/widgets/UpcomingEventsStat.vue.d.ts +4 -1
- package/dist/runtime/campaigns-owner.d.ts +38 -0
- package/dist/runtime/campaigns-owner.js +123 -0
- package/dist/runtime/dashboard.d.ts +6 -0
- package/dist/runtime/dashboard.js +19 -0
- package/dist/runtime/i18n/lang/da.json +41 -2
- package/dist/runtime/i18n/lang/en.json +41 -2
- package/dist/runtime/server/grants/event.d.ts +3 -0
- package/dist/runtime/server/grants/event.js +38 -0
- package/dist/runtime/server/mcp/tools/admin/list-all-events.js +2 -1
- package/dist/runtime/server/plugins/campaigns-owner.d.ts +2 -0
- package/dist/runtime/server/plugins/campaigns-owner.js +39 -0
- package/dist/runtime/server/plugins/payment-hooks.js +2 -2
- package/dist/runtime/server/{bootstrap → preload}/my-tickets.d.ts +1 -1
- package/dist/runtime/server/routes/admin/attendees.get.js +5 -2
- package/dist/runtime/server/routes/admin/check-in.post.js +1 -0
- package/dist/runtime/server/routes/admin/event.delete.js +1 -0
- package/dist/runtime/server/routes/admin/events.get.js +4 -3
- package/dist/runtime/server/routes/admin/upcoming.get.js +7 -2
- package/dist/runtime/server/routes/me/tickets.get.js +1 -1
- package/dist/runtime/server/utils/admin.d.ts +16 -2
- package/dist/runtime/server/utils/admin.js +25 -0
- package/dist/runtime/server/utils/tickets.js +1 -1
- package/dist/runtime/utils/api.d.ts +1 -1
- package/dist/runtime/utils/api.js +1 -1
- package/dist/runtime/utils/grants.d.ts +18 -0
- package/dist/runtime/utils/grants.js +17 -0
- package/dist/types.d.mts +1 -1
- package/package.json +28 -14
- /package/dist/runtime/server/{bootstrap → preload}/my-tickets.js +0 -0
|
@@ -13,7 +13,7 @@ export default defineNitroPlugin((nitro) => {
|
|
|
13
13
|
const [updated] = await db.update(schema.eventTickets).set({ status: "paid", paymentId: ctx.payment.id }).where(and(eq(schema.eventTickets.id, ticket.id), inArray(schema.eventTickets.status, ["pending", "expired", "cancelled"]))).returning();
|
|
14
14
|
if (!updated) return;
|
|
15
15
|
const [dto] = await toTicketDtos([updated]);
|
|
16
|
-
await nitro.hooks.callHook("events:ticket:paid", { ticket: dto });
|
|
16
|
+
await nitro.hooks.callHook("events:ticket:paid", { ticket: dto, userId: updated.userId });
|
|
17
17
|
});
|
|
18
18
|
const release = (status) => async (ctx) => {
|
|
19
19
|
const ticket = await ticketOf(ctx);
|
|
@@ -29,6 +29,6 @@ export default defineNitroPlugin((nitro) => {
|
|
|
29
29
|
const [updated] = await db.update(schema.eventTickets).set({ status: "refunded" }).where(eq(schema.eventTickets.id, ticket.id)).returning();
|
|
30
30
|
if (!updated) return;
|
|
31
31
|
const [dto] = await toTicketDtos([updated]);
|
|
32
|
-
await nitro.hooks.callHook("events:ticket:refunded", { ticket: dto });
|
|
32
|
+
await nitro.hooks.callHook("events:ticket:refunded", { ticket: dto, userId: updated.userId });
|
|
33
33
|
});
|
|
34
34
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { H3Event } from 'h3';
|
|
2
2
|
import type { TicketDto } from '../../../types.js';
|
|
3
3
|
/**
|
|
4
|
-
* The caller's tickets: the body of `GET /api/events/me/tickets` and the account
|
|
4
|
+
* The caller's tickets: the body of `GET /api/events/me/tickets` and the account preload's `events:tickets:mine`
|
|
5
5
|
* (the key `useMyTickets()` reads), so both always return the same thing.
|
|
6
6
|
*/
|
|
7
7
|
export default function myTickets(event: H3Event): Promise<TicketDto[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { db, schema } from "@nuxthub/db";
|
|
2
|
-
import { and, count, eq, or } from "drizzle-orm";
|
|
2
|
+
import { and, count, eq, isNotNull, isNull, or } from "drizzle-orm";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { idParams, likeContains, notFound, orderByQuery, pageQuery, pageRange, paginate } from "@frigear-nu/module-kit/server";
|
|
5
5
|
const querySchema = pageQuery({
|
|
@@ -8,7 +8,8 @@ const querySchema = pageQuery({
|
|
|
8
8
|
defaultOrder: "asc",
|
|
9
9
|
defaultPageSize: 50,
|
|
10
10
|
filters: {
|
|
11
|
-
status: z.enum(["pending", "paid", "cancelled", "refunded", "expired"]).optional()
|
|
11
|
+
status: z.enum(["pending", "paid", "cancelled", "refunded", "expired"]).optional(),
|
|
12
|
+
checkedIn: z.enum(["true", "false"]).optional()
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
15
|
export default defineEventHandler(async (event) => {
|
|
@@ -21,6 +22,8 @@ export default defineEventHandler(async (event) => {
|
|
|
21
22
|
const conditions = [eq(schema.eventTickets.eventId, id)];
|
|
22
23
|
if (query.q) conditions.push(or(likeContains(schema.users.name, query.q), likeContains(schema.users.email, query.q)));
|
|
23
24
|
if (query.status) conditions.push(eq(schema.eventTickets.status, query.status));
|
|
25
|
+
if (query.checkedIn === "true") conditions.push(isNotNull(schema.eventTickets.checkedInAt));
|
|
26
|
+
if (query.checkedIn === "false") conditions.push(isNull(schema.eventTickets.checkedInAt));
|
|
24
27
|
const where = and(...conditions);
|
|
25
28
|
const orderBy = orderByQuery({
|
|
26
29
|
createdAt: schema.eventTickets.createdAt,
|
|
@@ -15,5 +15,6 @@ export default defineEventHandler(async (event) => {
|
|
|
15
15
|
const [claimed] = await db.update(schema.eventTickets).set({ checkedInAt: /* @__PURE__ */ new Date(), checkedInBy: userId }).where(and(eq(schema.eventTickets.id, ticket.id), isNull(schema.eventTickets.checkedInAt))).returning();
|
|
16
16
|
const row = claimed ?? (await db.select().from(schema.eventTickets).where(eq(schema.eventTickets.id, ticket.id)).limit(1))[0];
|
|
17
17
|
const [dto] = await toTicketDtos([row]);
|
|
18
|
+
if (claimed) await useNitroApp().hooks.callHook("events:ticket:checked-in", { ticket: dto, userId: row.userId, checkedInBy: userId });
|
|
18
19
|
return { ok: true, alreadyCheckedIn: !claimed, checkedInAt: row.checkedInAt.toISOString(), ticket: { ...dto, code: null } };
|
|
19
20
|
});
|
|
@@ -10,5 +10,6 @@ export default defineEventHandler(async (event) => {
|
|
|
10
10
|
const [sold] = await db.select({ count: sql`count(*)` }).from(schema.eventTickets).where(and(eq(schema.eventTickets.eventId, id), eq(schema.eventTickets.status, "paid")));
|
|
11
11
|
if (Number(sold?.count ?? 0) > 0) throw conflict("This event has paid tickets. Archive it instead.");
|
|
12
12
|
await db.delete(schema.events).where(eq(schema.events.id, id));
|
|
13
|
+
await useNitroApp().hooks.callHook("events:deleted", { event: toAdminEventDto(existing) });
|
|
13
14
|
return noContent(event);
|
|
14
15
|
});
|
|
@@ -3,6 +3,7 @@ import { and, count, eq, is, or, sql } from "drizzle-orm";
|
|
|
3
3
|
import { PgTable } from "drizzle-orm/pg-core";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { escapeLike, likeContains, orderByQuery, pageQuery, pageRange, paginate } from "@frigear-nu/module-kit/server";
|
|
6
|
+
import { eventsListFilter } from "../../utils/admin.js";
|
|
6
7
|
function translatedContains(column, value) {
|
|
7
8
|
const pattern = `%${escapeLike(value)}%`;
|
|
8
9
|
if (is(schema.events, PgTable)) {
|
|
@@ -18,12 +19,12 @@ const querySchema = pageQuery({
|
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
export default defineEventHandler(async (event) => {
|
|
21
|
-
await authorize(event, "events:manage");
|
|
22
|
+
const principal = await authorize(event, "events:manage");
|
|
22
23
|
const query = await getValidatedQuery(event, querySchema.parse);
|
|
23
|
-
const conditions = [];
|
|
24
|
+
const conditions = [await eventsListFilter(event, principal)];
|
|
24
25
|
if (query.q) conditions.push(or(translatedContains(schema.events.name, query.q), likeContains(schema.events.slug, query.q)));
|
|
25
26
|
if (query.status) conditions.push(eq(schema.events.status, query.status));
|
|
26
|
-
const where =
|
|
27
|
+
const where = and(...conditions);
|
|
27
28
|
const orderBy = orderByQuery({
|
|
28
29
|
startsAt: schema.events.startsAt,
|
|
29
30
|
createdAt: schema.events.createdAt,
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { db, schema } from "@nuxthub/db";
|
|
2
2
|
import { and, asc, count, eq, gte } from "drizzle-orm";
|
|
3
3
|
import { isoDate } from "@frigear-nu/module-kit/server";
|
|
4
|
+
import { eventsListFilter } from "../../utils/admin.js";
|
|
4
5
|
const LIMIT = 5;
|
|
5
6
|
export default defineEventHandler(async (event) => {
|
|
6
|
-
await authorize(event, "events:manage");
|
|
7
|
-
const upcoming = and(
|
|
7
|
+
const principal = await authorize(event, "events:manage");
|
|
8
|
+
const upcoming = and(
|
|
9
|
+
eq(schema.events.status, "published"),
|
|
10
|
+
gte(schema.events.startsAt, /* @__PURE__ */ new Date()),
|
|
11
|
+
await eventsListFilter(event, principal)
|
|
12
|
+
);
|
|
8
13
|
const [[total], rows] = await Promise.all([
|
|
9
14
|
db.select({ value: count() }).from(schema.events).where(upcoming),
|
|
10
15
|
db.select({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import myTickets from "../../
|
|
1
|
+
import myTickets from "../../preload/my-tickets.js";
|
|
2
2
|
export default defineEventHandler(myTickets);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { H3Event } from 'h3';
|
|
2
|
+
import { schema } from '@nuxthub/db';
|
|
2
3
|
import type { z } from 'zod';
|
|
4
|
+
import type { SQL } from 'drizzle-orm';
|
|
5
|
+
import type { AuthPrincipal } from '@frigear-nu/auth/utils';
|
|
3
6
|
import { eventInput, ticketTypeInput } from './admin-schemas.js';
|
|
4
7
|
import { eventsAccess } from '../../access.js';
|
|
5
8
|
import type { addonGroupInput } from './admin-schemas.js';
|
|
@@ -7,6 +10,12 @@ type TicketTypeInput = z.output<typeof ticketTypeInput>;
|
|
|
7
10
|
type AddonGroupInput = z.output<typeof addonGroupInput>;
|
|
8
11
|
/** The permissions whose record-level policies run on one event. */
|
|
9
12
|
export type EventsRecordPermission = typeof eventsAccess.permissions.manage | typeof eventsAccess.permissions.refund;
|
|
13
|
+
/**
|
|
14
|
+
* The host's narrowing of the staff lists of events (`events:list:filter`), as one condition on `schema.events`, or
|
|
15
|
+
* `undefined` when no listener narrows. Every list that checks `events:manage` without a record ANDs it into its query,
|
|
16
|
+
* so a host policy on `events:manage` can be mirrored once for all of them.
|
|
17
|
+
*/
|
|
18
|
+
export declare function eventsListFilter(event: H3Event, principal: AuthPrincipal): Promise<SQL | undefined>;
|
|
10
19
|
/**
|
|
11
20
|
* Loads the event `eventId` (404 `not_found`) and authorizes `permission` on it. Every record-level check of
|
|
12
21
|
* `events:manage` and `events:refund` goes through here, so their policies always receive the stored EVENT row
|
|
@@ -49,19 +58,24 @@ export declare const eventPatchSchema: z.ZodObject<{
|
|
|
49
58
|
archived: "archived";
|
|
50
59
|
}>>>;
|
|
51
60
|
image: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
61
|
+
startsAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
62
|
+
endsAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
52
63
|
slug: z.ZodOptional<z.ZodString>;
|
|
53
64
|
body: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodTransform<{
|
|
54
65
|
[k: string]: string;
|
|
55
66
|
}, Record<string, string>>>]>>>>;
|
|
56
|
-
startsAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
57
67
|
location: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodTransform<{
|
|
58
68
|
[k: string]: string;
|
|
59
69
|
}, Record<string, string>>>]>>>>;
|
|
60
70
|
locationUrl: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
61
|
-
endsAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>>;
|
|
62
71
|
requiresMembership: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"any">, z.ZodArray<z.ZodString>]>>>>;
|
|
63
72
|
}, z.core.$strip>;
|
|
64
73
|
export declare function patchEventRow(id: string, patch: z.output<typeof eventPatchSchema>): Promise<any>;
|
|
74
|
+
/**
|
|
75
|
+
* The hooks of a changed event: `events:updated` (with the dates that changed) after every update, then
|
|
76
|
+
* `events:status-changed` when its status did. Owners of the event's other data (campaigns' messages) follow from them.
|
|
77
|
+
*/
|
|
78
|
+
export declare function eventsEmitUpdate(previous: typeof schema.events.$inferSelect, row: typeof schema.events.$inferSelect): Promise<void>;
|
|
65
79
|
export declare const ticketTypePatchSchema: z.ZodObject<{
|
|
66
80
|
name: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodTransform<{
|
|
67
81
|
[k: string]: string;
|
|
@@ -5,6 +5,12 @@ import { badRequest, conflict, notFound } from "@frigear-nu/module-kit/server";
|
|
|
5
5
|
import { loadCatalog } from "./catalog.js";
|
|
6
6
|
import { eventInput, ticketTypeInput } from "./admin-schemas.js";
|
|
7
7
|
import { eventsAccess } from "../../access.js";
|
|
8
|
+
import { toAdminEventDto } from "./admin-dto.js";
|
|
9
|
+
export async function eventsListFilter(event, principal) {
|
|
10
|
+
const ctx = { event, principal, where: [] };
|
|
11
|
+
await useNitroApp().hooks.callHook("events:list:filter", ctx);
|
|
12
|
+
return ctx.where.length ? and(...ctx.where) : void 0;
|
|
13
|
+
}
|
|
8
14
|
export async function authorizeEventsRecord(event, eventId, permission = eventsAccess.permissions.manage) {
|
|
9
15
|
const [row] = await db.select().from(schema.events).where(eq(schema.events.id, eventId)).limit(1);
|
|
10
16
|
if (!row) throw notFound("Event not found.");
|
|
@@ -79,10 +85,29 @@ export async function patchEventRow(id, patch) {
|
|
|
79
85
|
const [taken] = await db.select({ id: schema.events.id }).from(schema.events).where(eq(schema.events.slug, patch.slug)).limit(1);
|
|
80
86
|
if (taken && taken.id !== id) throw conflict("An event with this slug already exists.", { field: "slug" });
|
|
81
87
|
}
|
|
88
|
+
const [previous] = await db.select().from(schema.events).where(eq(schema.events.id, id)).limit(1);
|
|
89
|
+
if (!previous) throw notFound("Event not found.");
|
|
82
90
|
const [row] = await db.update(schema.events).set(patch).where(eq(schema.events.id, id)).returning();
|
|
83
91
|
if (!row) throw notFound("Event not found.");
|
|
92
|
+
await eventsEmitUpdate(previous, row);
|
|
84
93
|
return row;
|
|
85
94
|
}
|
|
95
|
+
const dateOf = (value) => value ? value.toISOString() : null;
|
|
96
|
+
export async function eventsEmitUpdate(previous, row) {
|
|
97
|
+
const hooks = useNitroApp().hooks;
|
|
98
|
+
const event = toAdminEventDto(row);
|
|
99
|
+
const before = toAdminEventDto(previous);
|
|
100
|
+
const changedDates = {};
|
|
101
|
+
for (const key of ["startsAt", "endsAt"]) {
|
|
102
|
+
const from = dateOf(previous[key]);
|
|
103
|
+
const to = dateOf(row[key]);
|
|
104
|
+
if (from !== to) changedDates[key] = { from, to };
|
|
105
|
+
}
|
|
106
|
+
await hooks.callHook("events:updated", { event, previous: before, changedDates });
|
|
107
|
+
if (previous.status !== row.status) {
|
|
108
|
+
await hooks.callHook("events:status-changed", { event, from: before.status, to: event.status });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
86
111
|
export const ticketTypePatchSchema = ticketTypeInput.omit({ addonGroups: true }).partial();
|
|
87
112
|
export async function patchTicketTypeRow(id, patch) {
|
|
88
113
|
await assertMembershipAvailable(patch);
|
|
@@ -84,7 +84,7 @@ export async function purchaseTicket(event, userId, slug, body) {
|
|
|
84
84
|
}
|
|
85
85
|
const [dto] = await toTicketDtos([inserted]);
|
|
86
86
|
if (amount === 0) {
|
|
87
|
-
await useNitroApp().hooks.callHook("events:ticket:paid", { ticket: dto });
|
|
87
|
+
await useNitroApp().hooks.callHook("events:ticket:paid", { ticket: dto, userId });
|
|
88
88
|
return { ticket: dto };
|
|
89
89
|
}
|
|
90
90
|
try {
|
|
@@ -6,7 +6,7 @@ export declare const eventsApi: {
|
|
|
6
6
|
/** `POST` a ticket purchase. */
|
|
7
7
|
readonly purchase: (slug: string) => string;
|
|
8
8
|
readonly me: {
|
|
9
|
-
/** `GET` the caller's tickets (also the account
|
|
9
|
+
/** `GET` the caller's tickets (also the account preload's `events:tickets:mine`). */
|
|
10
10
|
readonly tickets: "/api/events/me/tickets";
|
|
11
11
|
/** `GET` one of the caller's tickets. */
|
|
12
12
|
readonly ticket: (id: string) => string;
|
|
@@ -9,7 +9,7 @@ export const eventsApi = {
|
|
|
9
9
|
/** `POST` a ticket purchase. */
|
|
10
10
|
purchase: (slug) => `${PUBLIC_BASE}/${enc(slug)}/purchase`,
|
|
11
11
|
me: {
|
|
12
|
-
/** `GET` the caller's tickets (also the account
|
|
12
|
+
/** `GET` the caller's tickets (also the account preload's `events:tickets:mine`). */
|
|
13
13
|
tickets: `${PUBLIC_BASE}/me/tickets`,
|
|
14
14
|
/** `GET` one of the caller's tickets. */
|
|
15
15
|
ticket: (id) => `${PUBLIC_BASE}/me/tickets/${enc(id)}`,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { EventGrant } from '../../types.js';
|
|
3
|
+
export declare const EVENT_GRANT_STATUSES: readonly ["paid", "checked-in", "not-checked-in"];
|
|
4
|
+
/** The most ticket types one grant may name. */
|
|
5
|
+
export declare const EVENT_GRANT_MAX_TICKET_TYPES = 50;
|
|
6
|
+
export declare const eventGrantSchema: z.ZodType<EventGrant>;
|
|
7
|
+
/** The fields of a ticket the grant looks at. */
|
|
8
|
+
export type EventGrantTicket = {
|
|
9
|
+
eventId: string;
|
|
10
|
+
ticketTypeId: string;
|
|
11
|
+
status: string;
|
|
12
|
+
checkedInAt: Date | string | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Whether `ticket` admits its holder under `grant`: a paid ticket to the grant's event, of one of its ticket types (all
|
|
16
|
+
* when none or an empty list is named), checked in or not as `status` asks (`paid`, the default, takes both).
|
|
17
|
+
*/
|
|
18
|
+
export declare function eventGrantAdmits(grant: EventGrant, ticket: EventGrantTicket): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const EVENT_GRANT_STATUSES = ["paid", "checked-in", "not-checked-in"];
|
|
3
|
+
export const EVENT_GRANT_MAX_TICKET_TYPES = 50;
|
|
4
|
+
export const eventGrantSchema = z.strictObject({
|
|
5
|
+
kind: z.literal("event"),
|
|
6
|
+
eventId: z.string().trim().min(1).max(64),
|
|
7
|
+
status: z.enum(EVENT_GRANT_STATUSES).optional(),
|
|
8
|
+
ticketTypeIds: z.array(z.string().trim().min(1).max(64)).max(EVENT_GRANT_MAX_TICKET_TYPES).optional()
|
|
9
|
+
});
|
|
10
|
+
export function eventGrantAdmits(grant, ticket) {
|
|
11
|
+
if (ticket.eventId !== grant.eventId || ticket.status !== "paid") return false;
|
|
12
|
+
if (grant.ticketTypeIds?.length && !grant.ticketTypeIds.includes(ticket.ticketTypeId)) return false;
|
|
13
|
+
const checkedIn = ticket.checkedInAt !== null && ticket.checkedInAt !== void 0;
|
|
14
|
+
if (grant.status === "checked-in") return checkedIn;
|
|
15
|
+
if (grant.status === "not-checked-in") return !checkedIn;
|
|
16
|
+
return true;
|
|
17
|
+
}
|
package/dist/types.d.mts
CHANGED
|
@@ -2,4 +2,4 @@ export { type Translated } from '@frigear-nu/ui/translated'
|
|
|
2
2
|
|
|
3
3
|
export { default } from './module.mjs'
|
|
4
4
|
|
|
5
|
-
export { type AddonDto, type AddonGroupDto, type AdminAddonDto, type AdminAddonGroupDto, type AdminEventDetailDto, type AdminEventDto, type AdminTicketTypeDto, type AttendeeDto, type CheckInResponse, type EventDetailDto, type EventStatus, type EventSummaryDto, type EventsRuntimeConfig, type MembershipCheckContext, type MembershipOption, type MembershipOptionsContext, type MembershipOptionsDto, type MembershipRequirement, type ModuleOptions, type PublicModuleOptions, type PurchaseBeforeContext, type PurchaseBody, type PurchaseResponse, type TicketDto, type TicketHookContext, type TicketStatus, type TicketTypeDto, type UpcomingEventsDto } from './module.mjs'
|
|
5
|
+
export { type AddonDto, type AddonGroupDto, type AdminAddonDto, type AdminAddonGroupDto, type AdminEventDetailDto, type AdminEventDto, type AdminTicketTypeDto, type AttendeeDto, type CheckInResponse, type EventDateChange, type EventDeletedContext, type EventDetailDto, type EventGrant, type EventGrantStatus, type EventStatus, type EventStatusChangedContext, type EventSummaryDto, type EventUpdatedContext, type EventsListFilterContext, type EventsRuntimeConfig, type MembershipCheckContext, type MembershipOption, type MembershipOptionsContext, type MembershipOptionsDto, type MembershipRequirement, type ModuleOptions, type PublicModuleOptions, type PurchaseBeforeContext, type PurchaseBody, type PurchaseResponse, type TicketCheckedInContext, type TicketDto, type TicketHookContext, type TicketStatus, type TicketTypeDto, type UpcomingEventsDto } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/events",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Events with ticket types, addons, capacity, membership requirements, Stripe payments and QR check-in for the frigear ecosystem, built on @frigear-nu/payments.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"frigear-module",
|
|
7
|
+
"nuxt-module"
|
|
8
|
+
],
|
|
5
9
|
"homepage": "https://docs.frigear.dev/modules/features/events",
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
@@ -35,15 +39,15 @@
|
|
|
35
39
|
"playground"
|
|
36
40
|
],
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@frigear-nu/admin": "^0.
|
|
39
|
-
"@frigear-nu/auth": "^0.
|
|
40
|
-
"@frigear-nu/mcp": "^0.5.
|
|
41
|
-
"@frigear-nu/module-kit": "^1.3.
|
|
42
|
-
"@frigear-nu/payments": "^0.
|
|
43
|
-
"@frigear-nu/stripe": "^0.4.
|
|
44
|
-
"@frigear-nu/subscriptions": "^0.
|
|
45
|
-
"@frigear-nu/ui": "^0.
|
|
46
|
-
"@frigear-nu/users": "^3.
|
|
42
|
+
"@frigear-nu/admin": "^0.6.0",
|
|
43
|
+
"@frigear-nu/auth": "^0.7.0",
|
|
44
|
+
"@frigear-nu/mcp": "^0.5.3",
|
|
45
|
+
"@frigear-nu/module-kit": "^1.3.13",
|
|
46
|
+
"@frigear-nu/payments": "^0.6.0",
|
|
47
|
+
"@frigear-nu/stripe": "^0.4.4",
|
|
48
|
+
"@frigear-nu/subscriptions": "^0.6.0",
|
|
49
|
+
"@frigear-nu/ui": "^0.3.0",
|
|
50
|
+
"@frigear-nu/users": "^3.2.0",
|
|
47
51
|
"@libsql/client": "^0.18.0",
|
|
48
52
|
"@nuxt/kit": "^4.6.4",
|
|
49
53
|
"@vueuse/core": "^15.0.0",
|
|
@@ -55,12 +59,20 @@
|
|
|
55
59
|
"zod": "^4.6.7"
|
|
56
60
|
},
|
|
57
61
|
"peerDependencies": {
|
|
58
|
-
"@frigear-nu/
|
|
59
|
-
"@frigear-nu/
|
|
62
|
+
"@frigear-nu/campaigns": "^0.1.0",
|
|
63
|
+
"@frigear-nu/dashboard": "^0.2.0",
|
|
64
|
+
"@frigear-nu/menu": "^0.4.2",
|
|
65
|
+
"@frigear-nu/widget": "^0.4.4",
|
|
60
66
|
"@nuxt/ui": "^4.12.0",
|
|
61
67
|
"@nuxthub/core": "^0.10.12"
|
|
62
68
|
},
|
|
63
69
|
"peerDependenciesMeta": {
|
|
70
|
+
"@frigear-nu/campaigns": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@frigear-nu/dashboard": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
64
76
|
"@frigear-nu/menu": {
|
|
65
77
|
"optional": true
|
|
66
78
|
},
|
|
@@ -72,8 +84,10 @@
|
|
|
72
84
|
}
|
|
73
85
|
},
|
|
74
86
|
"devDependencies": {
|
|
75
|
-
"@frigear-nu/
|
|
76
|
-
"@frigear-nu/
|
|
87
|
+
"@frigear-nu/campaigns": "^0.1.0",
|
|
88
|
+
"@frigear-nu/dashboard": "^0.2.0",
|
|
89
|
+
"@frigear-nu/menu": "^0.4.2",
|
|
90
|
+
"@frigear-nu/widget": "^0.4.4",
|
|
77
91
|
"@nuxt/devtools": "^4.2.0",
|
|
78
92
|
"@nuxt/eslint-config": "^1.17.0",
|
|
79
93
|
"@nuxt/module-builder": "^1.0.4",
|
|
File without changes
|