test: Seed GCal test credentials (#12596)

* Seed GCal test credentials

* Set yml .env to secrets

* Switch to vars

* Add error messages

* Set error message

* Error messages

* Change .env to secrets

* Run db-seed even with cache

* Add with DATABASE_URL

* Set DB URL

* Set DB URL

* Inputs DB URL

* Move database URL to with block

* Create env under yarn db-studio

* Fix typo

* WIP

* WIP

* WIP

* WIP

* WIP

* Add credential console log

* Hit cache

* Add logs

* Remove echo

* Run on ubuntu latest

* Don't cache db

* Uncache

* WIP

* WIP

* Change back to buildjet

* Seed GCal keys in test

* Test uses GCal keys

* Parse keys

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Clean up

* Type fix

* Clean up

* Clean up
This commit is contained in:
Joe Au-Yeung authored and GitHub committed 2023-12-20 14:28:24 -05:00
1 parent b384e4a9d8
commit 4faad64978
10 files changed
+135 -60

No files matched your search

+21
View File
@@ -10,6 +10,7 @@ import prisma from ".";
export async function createUserAndEventType({
user,
eventTypes = [],
credentials,
}: {
user: {
email: string;
@@ -27,6 +28,11 @@ export async function createUserAndEventType({
_numBookings?: number;
}
>;
credentials?: ({
type: string;
key: Prisma.JsonObject;
appId: string;
} | null)[];
}) {
const userData = {
...user,
@@ -144,5 +150,20 @@ export async function createUserAndEventType({
}
}
console.log("👤 User with it's event-types and bookings created", theUser.email);
if (credentials) {
for (const credential of credentials) {
if (credential) {
await prisma.credential.create({
data: {
...credential,
userId: theUser.id,
},
});
console.log(`🔑 ${credential.type} credentials created for ${theUser.email}`);
}
}
}
return theUser;
}