mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(server): calculate sha1 checksum (#525)
* feat(server): override multer storage * feat(server): calc sha1 of uploaded file * feat(server): add checksum into asset * chore(server): add package-lock for mkdirp package * fix(server): free hash stream * chore(server): rollback this changes, not refactor here * refactor(server): re-arrange import statement * fix(server): make sure hash done before callback * refactor(server): replace varchar to char for checksum, reserve pixelChecksum for future * refactor(server): remove pixelChecksum * refactor(server): convert checksum from string to bytea * feat(server): add index to checksum * refactor(): rollback package.json changes * feat(server): remove uploaded file when progress fail * feat(server): calculate hash in sequence
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Column, Entity, OneToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
||||
import { Column, Entity, Index, OneToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
||||
import { ExifEntity } from './exif.entity';
|
||||
import { SmartInfoEntity } from './smart-info.entity';
|
||||
|
||||
@@ -44,6 +44,10 @@ export class AssetEntity {
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
mimeType!: string | null;
|
||||
|
||||
@Column({ type: 'bytea', nullable: true, select: false })
|
||||
@Index({ where: `'checksum' IS NOT NULL` }) // avoid null index
|
||||
checksum?: Buffer | null; // sha1 checksum
|
||||
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
duration!: string | null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user