refactor: Migrate repositories/services from /lib to /features (#25925)

* deployment

* update imports

* booking report

* update import paths

* watch list

* watch list

* api key

* api key

* selected slots

* wip

* event type translation

* work flow step

* booking reference

* fix tests

* fix

* fix

* migrate

* wip

* address

* fix
This commit is contained in:
Benny Joo authored and GitHub committed 2025-12-17 14:14:50 +00:00
1 parent aaaff0705b
commit cb7844fd22
69 files changed
+197 -162

No files matched your search

@@ -0,0 +1,68 @@
import { prisma } from "@calcom/prisma";
import type { EventTypeTranslation } from "@calcom/prisma/client";
import { EventTypeAutoTranslatedField } from "@calcom/prisma/enums";
export type CreateEventTypeTranslation = Omit<
EventTypeTranslation,
| "uid"
| "createdAt"
| "createdBy"
| "updatedAt"
| "updatedBy"
| "eventType"
| "field"
| "creator"
| "updater"
> & { userId: number };
export class EventTypeTranslationRepository {
static async upsertManyTitleTranslations(translations: Array<CreateEventTypeTranslation>) {
return await Promise.all(
translations.map(({ userId, ...translation }) => {
return prisma.eventTypeTranslation.upsert({
where: {
eventTypeId_field_targetLocale: {
eventTypeId: translation.eventTypeId,
field: EventTypeAutoTranslatedField.TITLE,
targetLocale: translation.targetLocale,
},
},
update: {
translatedText: translation.translatedText,
updatedBy: userId,
},
create: {
...translation,
field: EventTypeAutoTranslatedField.TITLE,
createdBy: userId,
},
});
})
);
}
static async upsertManyDescriptionTranslations(translations: Array<CreateEventTypeTranslation>) {
return await Promise.all(
translations.map(({ userId, ...translation }) => {
return prisma.eventTypeTranslation.upsert({
where: {
eventTypeId_field_targetLocale: {
eventTypeId: translation.eventTypeId,
field: EventTypeAutoTranslatedField.DESCRIPTION,
targetLocale: translation.targetLocale,
},
},
update: {
translatedText: translation.translatedText,
updatedBy: userId,
},
create: {
...translation,
field: EventTypeAutoTranslatedField.DESCRIPTION,
createdBy: userId,
},
});
})
);
}
}