Skip to content

Commit

Permalink
fix(database): update传值Partial
Browse files Browse the repository at this point in the history
  • Loading branch information
hanaTsuk1 committed Oct 5, 2023
1 parent e4f801f commit 2d4129a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/database/models/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function set(target, propertyKey, parameterIndex) {
}

export function injectModel<E, V>(options?: {
set?: (value: V) => Partial<E>
set?: (value: Partial<V>) => Partial<E>
get?: (entity: E) => Partial<V>
relation?: { [K in TableName]?: object }
}) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/database/models/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Model, get, injectModel } from './model'

@injectModel<OriginProgram, TransformProgram>({
set: v => ({
icon: v.icon.join(','),
icon: v.icon?.join(','),
}),
get: e => ({
icon: e.icon.split(',').map(Number),
Expand Down

0 comments on commit 2d4129a

Please sign in to comment.