╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────╮ │src/event/User.zig│ ╰──────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │133 if (existing_cursor_maybe == null) { │ │134 const user_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-id-set"));│ │135 const user_id_set = try DB.SortedSet(.read_write).init(user_id_set_cursor); │ │146 - const order_key = evt.orderKeyDesc(event_to_write.created_ts, event_id); │ │136 + const order_key = evt.orderKeyDesc(record_to_write.created_ts, event_id); │ │137 try user_id_set.put(&order_key); │ │138 } │ │139 } else { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │140 // read the user so we can drop its name and email index entries │ │141 if (try event_id_to_user.getCursor(user_key)) |existing_cursor| { │ │142 const existing_user = try DB.HashMap(.read_only).init(existing_cursor); │ │153 - const existing_event = try evt.read(@This(), DB, hash_kind, arena, existing_user); │ │154 - _ = try name_to_user_id.remove(hash.hashInt(hash_kind, existing_event.name)); │ │155 - _ = try email_to_user_id.remove(hash.hashInt(hash_kind, existing_event.email)); │ │143 + const existing_record = try evt.read(Record, DB, hash_kind, arena, existing_user); │ │144 + _ = try name_to_user_id.remove(hash.hashInt(hash_kind, existing_record.event.name)); │ │145 + _ = try email_to_user_id.remove(hash.hashInt(hash_kind, existing_record.event.email)); │ │146 │ │147 // drop it from the ordered set using its recorded creation timestamp │ │148 const user_id_set_cursor = try haxy_moment.putCursor(hash.hashInt(hash_kind, "user-id-set"));│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │149 const user_id_set = try DB.SortedSet(.read_write).init(user_id_set_cursor);│ │160 - const order_key = evt.orderKeyDesc(existing_event.created_ts, event_id); │ │150 + const order_key = evt.orderKeyDesc(existing_record.created_ts, event_id); │ │151 _ = try user_id_set.remove(&order_key); │ │152 │ │153 _ = try conflicts.remove(&order_key); │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │205 │ │206 const user_cursor = try event_id_to_user.getCursor(user_key) orelse return .unknown_user; │ │207 const user_map = try DB.HashMap(.read_only).init(user_cursor); │ │218 - const user_event = try evt.read(@This(), DB, hash_kind, arena, user_map); │ │208 + const user_event = try evt.read(Record, DB, hash_kind, arena, user_map); │ │209 │ │220 - bcrypt.strVerify(user_event.password_hash, password, .{ .silently_truncate_password = false }) catch { │ │210 + bcrypt.strVerify(user_event.event.password_hash, password, .{ .silently_truncate_password = false }) catch {│ │211 return .wrong_password; │ │212 }; │ │213 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │222 haxy_moment: DB.HashMap(.read_only), │ │223 arena: *std.heap.ArenaAllocator, │ │224 user_id: []const u8, │ │235 -) !?@This() { │ │225 +) !?Record { │ │226 const event_id_to_user_cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, "event-id->user")) orelse return null;│ │227 const event_id_to_user = try DB.HashMap(.read_only).init(event_id_to_user_cursor); │ │228 const user_cursor = try event_id_to_user.getCursor(hash.hashInt(hash_kind, user_id)) orelse return null; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │229 const user_map = try DB.HashMap(.read_only).init(user_cursor); │ │240 - return try evt.read(@This(), DB, hash_kind, arena, user_map); │ │230 + return try evt.read(Record, DB, hash_kind, arena, user_map); │ │231 } │ │232 │ │233 // read a user by email via the email->user-id index, or null when no user has│ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │238 haxy_moment: DB.HashMap(.read_only), │ │239 arena: *std.heap.ArenaAllocator, │ │240 email: []const u8, │ │251 -) !?@This() { │ │241 +) !?Record { │ │242 const email_to_user_id_cursor = (try haxy_moment.getCursor(hash.hashInt(hash_kind, email_to_user_id_key))) orelse return null;│ │243 const email_to_user_id = try DB.HashMap(.read_only).init(email_to_user_id_cursor); │ │244 const user_id_cursor = (try email_to_user_id.getCursor(hash.hashInt(hash_kind, email))) orelse return null; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │255 admin_repo_path: []const u8, │ │256 arena: *std.heap.ArenaAllocator, │ │257 name: []const u8, │ │268 -) !?Self { │ │258 +) !?Record { │ │259 var repo = rp.Repo(.xit, evt.admin_repo_opts).open(io, allocator, .{ .path = admin_repo_path }) catch |err| switch (err) {│ │260 error.RepoNotFound => return null, │ │261 else => |e| return e, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │289 const moment = try evt.currentMoment(repo_opts, repo); │ │290 const user = (try readById(DB, repo_opts.hash, moment, &arena, user_id)) orelse return; │ │291 │ │302 - var updated = user; │ │303 - updated.enable_ansi = !user.enable_ansi; │ │292 + var updated = user.event; │ │293 + updated.enable_ansi = !updated.enable_ansi; │ │294 try evt.consume(.xit, repo_opts, io, allocator, repo, evt.events_ref, &[_]evt.EventWithId{.{│ │295 .id = std.fmt.bytesToHex(user_id[0..evt.event_id_size].*, .lower), │ │296 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()), │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────╮ │307 - .author_email = user.email, │ │297 + .author_email = user.event.email,│ │298 .event = .{ .user = updated }, │ │299 }}); │ │300 } │ ╰──────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯