style: #6556 set default user image, set users image #2168
|
@ -1,7 +1,6 @@
|
||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
storage
|
|
||||||
.idea
|
.idea
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
|
@ -4,20 +4,21 @@ describe('image download()', () => {
|
||||||
const collection = 'user';
|
const collection = 'user';
|
||||||
const size = '160x160';
|
const size = '160x160';
|
||||||
const employeeId = 1;
|
const employeeId = 1;
|
||||||
|
const developerId = 9;
|
||||||
|
const jessicaJonesId = 1110;
|
||||||
const ctx = {req: {accessToken: {userId: employeeId}}};
|
const ctx = {req: {accessToken: {userId: employeeId}}};
|
||||||
|
|
||||||
it('should return the image content-type of the user', async() => {
|
it('should return the image content-type of the user', async() => {
|
||||||
const userId = 9;
|
const image = await models.Image.download(ctx, collection, size, developerId);
|
||||||
const image = await models.Image.download(ctx, collection, size, userId);
|
|
||||||
const contentType = image[1];
|
const contentType = image[1];
|
||||||
|
|
||||||
expect(contentType).toEqual('image/png');
|
expect(contentType).toEqual('image/png');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should return false if the user doesn't have image`, async() => {
|
it('should return the user profile picture', async() => {
|
||||||
jon marked this conversation as resolved
Outdated
|
jon marked this conversation as resolved
jgallego
commented
estos comentarios no son necesarios porque la explicacion ya esta en el it estos comentarios no son necesarios porque la explicacion ya esta en el it
|
||||||
const userId = 1110;
|
const image = await models.Image.download(ctx, collection, size, jessicaJonesId);
|
||||||
const image = await models.Image.download(ctx, collection, size, userId);
|
const fileName = image[2];
|
||||||
|
|
||||||
expect(image).toBeFalse();
|
expect(fileName).toMatch('1110.png');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -118,18 +118,18 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
|
||||||
|
|
||||||
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
|
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'BruceWayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1101, 'BruceWayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es','1101'),
|
||||||
(1102, 'PetterParker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1102, 'PetterParker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en','1102'),
|
||||||
(1103, 'ClarkKent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1103, 'ClarkKent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr','1103'),
|
||||||
(1104, 'TonyStark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1104, 'TonyStark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es','1104'),
|
||||||
(1105, 'MaxEisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1105, 'MaxEisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt','1105'),
|
||||||
(1106, 'DavidCharlesHaller', 'David Charles Haller', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'DavidCharlesHaller@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1106, 'DavidCharlesHaller', 'David Charles Haller', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'DavidCharlesHaller@mydomain.com', 'en','1106'),
|
||||||
(1107, 'HankPym', 'Hank Pym', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'HankPym@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1107, 'HankPym', 'Hank Pym', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'HankPym@mydomain.com', 'en','1107'),
|
||||||
(1108, 'CharlesXavier', 'Charles Xavier', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'CharlesXavier@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1108, 'CharlesXavier', 'Charles Xavier', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'CharlesXavier@mydomain.com', 'en','1108'),
|
||||||
(1109, 'BruceBanner', 'Bruce Banner', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'BruceBanner@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1109, 'BruceBanner', 'Bruce Banner', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'BruceBanner@mydomain.com', 'en','1109'),
|
||||||
(1110, 'JessicaJones', 'Jessica Jones', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'JessicaJones@mydomain.com', 'en', NULL),
|
(1110, 'JessicaJones', 'Jessica Jones', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'JessicaJones@mydomain.com', 'en','1110'),
|
||||||
(1111, 'Missing', 'Missing', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 0, NULL, 'en', NULL),
|
(1111, 'Missing', 'Missing', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 0, NULL, 'en','e7723f0b24ff05b32ed09d95196f2f29'),
|
||||||
jon marked this conversation as resolved
Outdated
alexm
commented
Poniendo el mismo hash que tienen los workers 1,9, etc aqui te evitarias tener que duplicar la foto generica Poniendo el mismo hash que tienen los workers 1,9, etc aqui te evitarias tener que duplicar la foto generica
alexm
commented
Si quieres mantener la imagen de "hacker" puedes ponerle al worker 1111 y 1112 el mismo hash De modo que: Y en storage: Si quieres mantener la imagen de "hacker" puedes ponerle al worker 1111 y 1112 el mismo hash
Pero luego a los archivos de la imagen quédate con uno solo.
**De modo que:**
Aquí en fixtures:
(1111, ..., hashQueTeInventes),
(1112, ..., hashQueTeInventes).
Y en storage:
storage/image/user/1600x1600/1111.png → storage/image/user/1600x1600/hashQueTeInventes.png
storage/image/user/1600x1600/1112.png → Eliminar
(hacer lo mismo en todas las medidas)
jon
commented
@alexm he hecho un pull de origin/dev y los workers 1111 y 1112 ya no existen. Borro entonces las referencias en db/dump/fixtures.before.sql y sus fotos? @alexm he hecho un pull de origin/dev y los workers 1111 y 1112 ya no existen. Borro entonces las referencias en db/dump/fixtures.before.sql y sus fotos?
alexm
commented
Vale ya no hacen falta. borra sus fotos Vale ya no hacen falta. borra sus fotos
|
|||||||
(1112, 'Trash', 'Trash', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 0, NULL, 'en', NULL);
|
(1112, 'Trash', 'Trash', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 0, NULL, 'en','e7723f0b24ff05b32ed09d95196f2f29');
|
||||||
|
|
||||||
UPDATE account.`user`
|
UPDATE account.`user`
|
||||||
SET passExpired = DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR)
|
SET passExpired = DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR)
|
||||||
|
|
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 973 KiB |
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 920 KiB |
After Width: | Height: | Size: 776 KiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 2.0 MiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 234 KiB |
After Width: | Height: | Size: 181 KiB |
After Width: | Height: | Size: 306 KiB |
After Width: | Height: | Size: 172 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 288 KiB |
After Width: | Height: | Size: 248 KiB |
After Width: | Height: | Size: 371 KiB |
After Width: | Height: | Size: 231 KiB |
After Width: | Height: | Size: 298 KiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 159 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 219 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 207 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 245 KiB |
After Width: | Height: | Size: 159 KiB |
After Width: | Height: | Size: 206 KiB |
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 9.9 KiB |
He quitado este test porque con esta tarea todos los usuarios pasan a tener foto, por lo que iba a dar error siempre