Skip to content

Commit

Permalink
fix: allow _patch to modify the entire base schema
Browse files Browse the repository at this point in the history
  • Loading branch information
AshotN committed Oct 5, 2023
1 parent 463dedc commit ed8189c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/knex/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ export class KnexAdapter<
})
}

async _patch(id: null, data: PatchData, params?: ServiceParams): Promise<Result[]>
async _patch(id: Id, data: PatchData, params?: ServiceParams): Promise<Result>
async _patch(id: NullableId, data: PatchData, _params?: ServiceParams): Promise<Result | Result[]>
async _patch(id: null, data: PatchData | Partial<Result>, params?: ServiceParams): Promise<Result[]>
async _patch(id: Id, data: PatchData | Partial<Result>, params?: ServiceParams): Promise<Result>
async _patch(id: NullableId, data: PatchData | Partial<Result>, _params?: ServiceParams): Promise<Result | Result[]>
async _patch(
id: NullableId,
raw: PatchData,
raw: PatchData | Partial<Result>,
params: ServiceParams = {} as ServiceParams
): Promise<Result | Result[]> {
if (id === null && !this.allowsMulti('patch', params)) {
Expand Down
8 changes: 4 additions & 4 deletions packages/memory/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ export class MemoryAdapter<
return this._get(id, params)
}

async _patch(id: null, data: PatchData, params?: ServiceParams): Promise<Result[]>
async _patch(id: Id, data: PatchData, params?: ServiceParams): Promise<Result>
async _patch(id: NullableId, data: PatchData, _params?: ServiceParams): Promise<Result | Result[]>
async _patch(id: null, data: PatchData | Partial<Result>, params?: ServiceParams): Promise<Result[]>
async _patch(id: Id, data: PatchData | Partial<Result>, params?: ServiceParams): Promise<Result>
async _patch(id: NullableId, data: PatchData | Partial<Result>, _params?: ServiceParams): Promise<Result | Result[]>
async _patch(
id: NullableId,
data: PatchData,
data: PatchData | Partial<Result>,
params: ServiceParams = {} as ServiceParams
): Promise<Result | Result[]> {
if (id === null && !this.allowsMulti('patch', params)) {
Expand Down
8 changes: 4 additions & 4 deletions packages/mongodb/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ export class MongoDbAdapter<
return promise.then(select(params, this.id)).catch(errorHandler)
}

async _patch(id: null, data: PatchData, params?: ServiceParams): Promise<Result[]>
async _patch(id: AdapterId, data: PatchData, params?: ServiceParams): Promise<Result>
async _patch(id: NullableAdapterId, data: PatchData, _params?: ServiceParams): Promise<Result | Result[]>
async _patch(id: null, data: PatchData | Partial<Result>, params?: ServiceParams): Promise<Result[]>
async _patch(id: AdapterId, data: PatchData | Partial<Result>, params?: ServiceParams): Promise<Result>
async _patch(id: NullableAdapterId, data: PatchData | Partial<Result>, _params?: ServiceParams): Promise<Result | Result[]>
async _patch(
id: NullableAdapterId,
_data: PatchData,
_data: PatchData | Partial<Result>,
params: ServiceParams = {} as ServiceParams
): Promise<Result | Result[]> {
if (id === null && !this.allowsMulti('patch', params)) {
Expand Down

0 comments on commit ed8189c

Please sign in to comment.