╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────╮ │ 9 pub const User = @import("event/User.zig"); │ │10 pub const Repo = @import("event/Repo.zig"); │ │11 pub const Issue = @import("event/Issue.zig"); │ │12 +pub const Discussion = @import("event/Discussion.zig");│ │13 pub const Comment = @import("event/Comment.zig"); │ │14 pub const Attachment = @import("event/Attachment.zig");│ │15 │ ╰───────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────╮ │55 return result; │ │56 } │ │57 │ │57 -// kept to eight bytes or fewer, so the db stores them as short bytes│ │58 pub const EventKind = enum { │ │59 user, │ │60 repo, │ ╰─────────────────────────────────────────────────────────────────────────╯ ╭───────────────────╮ │61 issue, │ │62 + discussion,│ │63 comment, │ │64 attach, │ │65 }; │ ╰───────────────────╯ ╭────────────────────────────────╮ │74 user: ?User, │ │75 repo: ?Repo, │ │76 issue: ?Issue, │ │77 + discussion: ?Discussion,│ │78 comment: ?Comment, │ │79 attach: ?Attachment, │ │80 }; │ ╰────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │140 .issue => .{ │ │141 .issue = if (json_event.data) |value| │ │142 try std.json.parseFromValueLeaky(Issue, arena.allocator(), value, .{ .ignore_unknown_fields = true }) │ │143 + else │ │144 + null, │ │145 + }, │ │146 + .discussion => .{ │ │147 + .discussion = if (json_event.data) |value| │ │148 + try std.json.parseFromValueLeaky(Discussion, arena.allocator(), value, .{ .ignore_unknown_fields = true })│ │149 else │ │150 null, │ │151 }, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────╮ │203 .user => .{ .user = null }, │ │204 .repo => .{ .repo = null }, │ │205 .issue => .{ .issue = null }, │ │206 + .discussion => .{ .discussion = null },│ │207 .comment => .{ .comment = null }, │ │208 .attach => .{ .attach = null }, │ │209 }; │ ╰────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │863 } else null; │ │864 try Issue.consume(DB, repo_opts.hash, haxy_moment, &current_event_id, record_maybe, &arena, &repo_event_oid); │ │865 }, │ │866 + .discussion => |event_maybe| { │ │867 + const record_maybe: ?Discussion.Record = if (event_maybe) |event| .{ │ │868 + .event = event, │ │869 + .author_email = authorEmail(commit_object.content.commit.metadata.author orelse ""), │ │870 + .created_ts = created_ts, │ │871 + } else null; │ │872 + try Discussion.consume(DB, repo_opts.hash, haxy_moment, &current_event_id, record_maybe, &arena, &repo_event_oid);│ │873 + }, │ │874 .comment => |event_maybe| { │ │875 const record_maybe: ?Comment.Record = if (event_maybe) |event| .{ │ │876 .event = event, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯