···
import type { SystemsGmstnDevelopmentLattice } from "@/lib/types/lexicon/systems.gmstn.development.lattice";
import type { SystemsGmstnDevelopmentChannelInvite } from "@/lib/types/lexicon/systems.gmstn.development.channel.invite";
import type { SystemsGmstnDevelopmentChannel } from "@/lib/types/lexicon/systems.gmstn.development.channel";
11
+
import type { SystemsGmstnDevelopmentChannelMembership } from "@/lib/types/lexicon/systems.gmstn.development.channel.membership";
export const getLatticeEndpointFromDid = async (did: Did) => {
return await getEndpointFromDid(did, "GemstoneLattice");
···
}): Promise<Result<undefined, string>> => {
155
-
const rkey = TID.create(now.getTime(), Math.random());
156
+
const rkey = TID.create(now.getTime(), Math.floor(Math.random() * 1023));
const record: Omit<SystemsGmstnDevelopmentChannel, "$type"> = {
// @ts-expect-error we want to explicitly use the ISO string variant
···
184
+
export const addMembership = async ({
188
+
membershipInfo: Omit<
189
+
SystemsGmstnDevelopmentChannelMembership,
190
+
"$type" | "createdAt" | "updatedAt"
193
+
}): Promise<Result<undefined, string>> => {
194
+
const now = new Date();
195
+
const rkey = TID.create(now.getTime(), Math.floor(Math.random() * 1023));
197
+
const record: Omit<SystemsGmstnDevelopmentChannelMembership, "$type"> = {
198
+
// @ts-expect-error we want to explicitly use the ISO string variant
199
+
createdAt: now.toISOString(),
200
+
// @ts-expect-error we want to explicitly use the ISO string variant
201
+
updatedAt: now.toISOString(),
205
+
const { success } = await agent.call(
206
+
"com.atproto.repo.createRecord",
210
+
collection: "systems.gmstn.development.channel.membership",
219
+
error: "Attempted to create channel record failed. Check the channel info inputs.",
222
+
return { ok: true };