mirror of
https://github.com/immich-app/immich.git
synced 2026-03-04 09:57:33 +03:00
feat: rename schema (#19891)
This commit is contained in:
@@ -17,15 +17,15 @@ export enum PartnerDirection {
|
||||
SharedWith = 'shared-with',
|
||||
}
|
||||
|
||||
const withSharedBy = (eb: ExpressionBuilder<DB, 'partners'>) => {
|
||||
const withSharedBy = (eb: ExpressionBuilder<DB, 'partner'>) => {
|
||||
return jsonObjectFrom(
|
||||
eb.selectFrom('users as sharedBy').select(columns.user).whereRef('sharedBy.id', '=', 'partners.sharedById'),
|
||||
eb.selectFrom('user as sharedBy').select(columns.user).whereRef('sharedBy.id', '=', 'partner.sharedById'),
|
||||
).as('sharedBy');
|
||||
};
|
||||
|
||||
const withSharedWith = (eb: ExpressionBuilder<DB, 'partners'>) => {
|
||||
const withSharedWith = (eb: ExpressionBuilder<DB, 'partner'>) => {
|
||||
return jsonObjectFrom(
|
||||
eb.selectFrom('users as sharedWith').select(columns.user).whereRef('sharedWith.id', '=', 'partners.sharedWithId'),
|
||||
eb.selectFrom('user as sharedWith').select(columns.user).whereRef('sharedWith.id', '=', 'partner.sharedWithId'),
|
||||
).as('sharedWith');
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ export class PartnerRepository {
|
||||
|
||||
create(values: Insertable<PartnerTable>) {
|
||||
return this.db
|
||||
.insertInto('partners')
|
||||
.insertInto('partner')
|
||||
.values(values)
|
||||
.returningAll()
|
||||
.returning(withSharedBy)
|
||||
@@ -62,7 +62,7 @@ export class PartnerRepository {
|
||||
@GenerateSql({ params: [{ sharedWithId: DummyValue.UUID, sharedById: DummyValue.UUID }, { inTimeline: true }] })
|
||||
update({ sharedWithId, sharedById }: PartnerIds, values: Updateable<PartnerTable>) {
|
||||
return this.db
|
||||
.updateTable('partners')
|
||||
.updateTable('partner')
|
||||
.set(values)
|
||||
.where('sharedWithId', '=', sharedWithId)
|
||||
.where('sharedById', '=', sharedById)
|
||||
@@ -76,7 +76,7 @@ export class PartnerRepository {
|
||||
@GenerateSql({ params: [{ sharedWithId: DummyValue.UUID, sharedById: DummyValue.UUID }] })
|
||||
async remove({ sharedWithId, sharedById }: PartnerIds) {
|
||||
await this.db
|
||||
.deleteFrom('partners')
|
||||
.deleteFrom('partner')
|
||||
.where('sharedWithId', '=', sharedWithId)
|
||||
.where('sharedById', '=', sharedById)
|
||||
.execute();
|
||||
@@ -84,14 +84,14 @@ export class PartnerRepository {
|
||||
|
||||
private builder() {
|
||||
return this.db
|
||||
.selectFrom('partners')
|
||||
.innerJoin('users as sharedBy', (join) =>
|
||||
join.onRef('partners.sharedById', '=', 'sharedBy.id').on('sharedBy.deletedAt', 'is', null),
|
||||
.selectFrom('partner')
|
||||
.innerJoin('user as sharedBy', (join) =>
|
||||
join.onRef('partner.sharedById', '=', 'sharedBy.id').on('sharedBy.deletedAt', 'is', null),
|
||||
)
|
||||
.innerJoin('users as sharedWith', (join) =>
|
||||
join.onRef('partners.sharedWithId', '=', 'sharedWith.id').on('sharedWith.deletedAt', 'is', null),
|
||||
.innerJoin('user as sharedWith', (join) =>
|
||||
join.onRef('partner.sharedWithId', '=', 'sharedWith.id').on('sharedWith.deletedAt', 'is', null),
|
||||
)
|
||||
.selectAll('partners')
|
||||
.selectAll('partner')
|
||||
.select(withSharedBy)
|
||||
.select(withSharedWith);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user