Skip to content

Scheduling infrastructure for absolutely everyone.

Updates snaplet transform script (#3199)

Omar López92bfb3e5b9d5
diff --git a/.snaplet/transform.ts b/.snaplet/transform.ts
index b5c28b8d6e3..b229acabcbd 100644
--- a/.snaplet/transform.ts
+++ b/.snaplet/transform.ts
@@ -1,7 +1,7 @@
// This transform config was generated by Snaplet.
// Snaplet found fields that may contain personally identifiable information (PII)
// and used that to populate this file.
-import { copycat } from "@snaplet/copycat";
+import { copycat as c } from "@snaplet/copycat";
import type { Transform } from "./structure";
@@ -11,13 +11,13 @@ function hasStringProp<T extends string>(x: unknown, key: T): x is { [key in T]:
function replaceKeyIfExists<T extends string>(x: object, key: T) {
if (hasStringProp(x, key)) {
- return { ...x, [key]: copycat.uuid(x[key]) };
+ return { ...x, [key]: c.uuid(x[key]) };
}
return x;
}
function generateSlug(x: string) {
- return copycat.words(x, { max: 3 }).split(" ").join("-");
+ return c.words(x, { max: 3 }).split(" ").join("-");
}
function replaceSensitiveKeys(record: object) {
@@ -39,57 +39,57 @@ function replaceSensitiveKeys(record: object) {
};
}
+const generateUsername = (x: string) => `${c.firstName(x)}-${c.lastName(x)}${c.int(x, { min: 2, max: 99 })}`;
+
const config: Transform = () => ({
public: {
- _user_eventtype: ({ row }) => ({
- A: copycat.int(row.A),
- B: copycat.int(row.B),
- }),
ApiKey: ({ row }) => ({
- note: copycat.sentence(row.note),
+ hashedKey: c.uuid(row.hashedKey),
}),
App: ({ row }) => ({
keys: replaceSensitiveKeys(row.keys),
}),
Attendee: ({ row }) => ({
- email: copycat.email(row.email),
- name: copycat.fullName(row.name),
- timeZone: copycat.timezone(row.timeZone),
- }),
- Availability: ({ row }) => ({
- // date: copycat.fullName(row.date),
+ email: c.email(row.email),
+ name: c.fullName(row.name),
+ timeZone: c.timezone(row.timeZone),
}),
Credential: ({ row }) => ({
- key: typeof row.key === "string" ? copycat.uuid(row.key) : replaceSensitiveKeys(row.key),
+ key: typeof row.key === "string" ? c.uuid(row.key) : replaceSensitiveKeys(row.key),
}),
EventType: ({ row }) => ({
slug: generateSlug(row.slug),
- timeZone: copycat.timezone(row.timeZone),
- }),
- Feedback: ({ row }) => ({
- // date: copycat.dateString(row.date),
+ timeZone: c.timezone(row.timeZone),
+ eventName: c.words(row.eventName, { max: 3 }),
}),
ResetPasswordRequest: ({ row }) => ({
- email: copycat.email(row.email),
+ email: c.email(row.email),
}),
Schedule: ({ row }) => ({
- timeZone: copycat.timezone(row.timeZone),
+ timeZone: c.timezone(row.timeZone),
}),
Team: ({ row }) => ({
- bio: copycat.sentence(row.bio),
- name: copycat.words(row.name, { max: 2 }),
+ bio: c.sentence(row.bio),
+ name: c.words(row.name, { max: 2 }),
slug: generateSlug(row.slug),
}),
- users: ({ row }) => ({
- bio: copycat.sentence(row.bio),
- email: copycat.email(row.email),
- name: copycat.fullName(row.name),
- password: copycat.password(row.password),
- timeZone: copycat.timezone(row.timeZone),
- username: generateSlug(row.username),
- }),
+ users: ({ row }) =>
+ row.role !== "ADMIN"
+ ? {
+ bio: c.sentence(row.bio),
+ email: c.email(row.email),
+ name: c.fullName(row.name),
+ password: c.password(row.password),
+ timeZone: c.timezone(row.timeZone),
+ username: generateUsername(row.username),
+ }
+ : row,
VerificationToken: ({ row }) => ({
- token: copycat.uuid(row.token),
+ token: c.uuid(row.token),
+ }),
+ Account: ({ row }) => ({
+ access_token: c.uuid(row.access_token),
+ refresh_token: c.uuid(row.refresh_token),
}),
},
});
diff --git a/packages/prisma/seed-app-store.config.json b/packages/prisma/seed-app-store.config.json
index 94ad9e36cf4..4999dee1b13 100644
--- a/packages/prisma/seed-app-store.config.json
+++ b/packages/prisma/seed-app-store.config.json
@@ -21,4 +21,3 @@
"type": "riverside_video"
}
]
-