-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4692 from alkem-io/release/homepage
Release: Homepage & Fixes
- Loading branch information
Showing
189 changed files
with
3,296 additions
and
19,478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
src/common/exceptions/http/ipfs.not.found.http.exception.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { PrefixKeys } from '@src/types'; | ||
|
||
/** | ||
* Expects a raw entity as input and converts it to a full typeorm entity. | ||
* The raw input is returned as a result from building typerom queries | ||
* and returned the result as raw data. | ||
* The entity usually is prefixed with the alias of the joined table. | ||
* | ||
* Example: | ||
* await this.calendarRepository | ||
* .createQueryBuilder('calendar') | ||
* .where({ id: calendarId }) | ||
* .leftJoinAndSelect( | ||
* 'space', | ||
* 'space', | ||
* 'space.collaborationId = collaboration.id' | ||
* ) | ||
* .getRawOne<PrefixKeys<Space, 'space_'>>(); | ||
* | ||
* const space = convertToEntity(rawSpace, 'space_'); | ||
* | ||
* @param prefixedEntity | ||
* @param prefix | ||
*/ | ||
export const convertToEntity = < | ||
T extends Record<string, any>, | ||
P extends string, | ||
>( | ||
prefixedEntity: PrefixKeys<T, P>, | ||
prefix: P | ||
): T => { | ||
return Object.keys(prefixedEntity).reduce((acc, key) => { | ||
const newKey = key.replace(prefix, '') as keyof T; | ||
acc[newKey] = prefixedEntity[ | ||
key as keyof PrefixKeys<T, P> | ||
] as unknown as T[keyof T]; | ||
return acc; | ||
}, {} as T); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './convert.to.entity'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { getDiff } from './get.diff'; | ||
|
||
describe('getDiff', () => { | ||
it('returns null when objects are identical', () => { | ||
const obj1 = { a: 1, b: 2 }; | ||
const obj2 = { a: 1, b: 2 }; | ||
const result = getDiff(obj1, obj2); | ||
expect(result).toBeNull(); | ||
}); | ||
|
||
it('returns differences when objects have different values', () => { | ||
const obj1 = { a: 1, b: 2 }; | ||
const obj2 = { a: 1, b: 3 }; | ||
const result = getDiff(obj1, obj2); | ||
expect(result).toEqual({ b: 3 }); | ||
}); | ||
|
||
it('returns differences when objects have some different nested values', () => { | ||
const obj1 = { a: 1, b: { c: 2, d: 3 } }; | ||
const obj2 = { a: 1, b: { c: 2, d: 4 } }; | ||
const result = getDiff(obj1, obj2); | ||
expect(result).toEqual({ b: { d: 4 } }); | ||
}); | ||
|
||
it('returns differences when objects have all different nested values', () => { | ||
const obj1 = { a: 1, b: { c: 2, d: 3 } }; | ||
const obj2 = { a: 1, b: { c: 4, d: 5 } }; | ||
const result = getDiff(obj1, obj2); | ||
expect(result).toEqual({ b: { c: 4, d: 5 } }); | ||
}); | ||
|
||
it('returns null when nested objects are identical', () => { | ||
const obj1 = { a: 1, b: { c: 2, d: 3 } }; | ||
const obj2 = { a: 1, b: { c: 2, d: 3 } }; | ||
const result = getDiff(obj1, obj2); | ||
expect(result).toBeNull(); | ||
}); | ||
|
||
it('returns null when objects have different keys', () => { | ||
type Type = { a: number; b?: number; c?: number }; | ||
const obj1: Type = { a: 1, b: 2 }; | ||
const obj2: Type = { a: 1, c: 3 }; | ||
const result = getDiff(obj1, obj2); | ||
expect(result).toBeNull(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Compares the first object to the second and returns the differences. | ||
* Comparison is done against the keys in obj1. | ||
* Return __null__ if no differences are found. | ||
* | ||
* @template T - The type of the objects being compared. | ||
* @param {T} obj1 - The first object to compare. | ||
* @param {T} obj2 - The second object to compare. | ||
* @returns {Partial<T> | null} - A partial object containing the differences, or null if no differences are found. | ||
*/ | ||
export const getDiff = <T extends Record<string, any>>( | ||
obj1: T, | ||
obj2: T | ||
): Partial<T> | null => { | ||
const result: Partial<T> = {}; | ||
|
||
for (const key in obj1) { | ||
if (obj1.hasOwnProperty(key) && obj2.hasOwnProperty(key)) { | ||
const value1 = obj1[key]; | ||
const value2 = obj2[key]; | ||
|
||
if ( | ||
typeof value1 === 'object' && | ||
typeof value2 === 'object' && | ||
value1 !== null && | ||
value2 !== null | ||
) { | ||
const nestedDiff = getDiff(value1, value2); | ||
if (nestedDiff !== null) { | ||
result[key] = nestedDiff as T[Extract<keyof T, string>]; | ||
} | ||
} else if (value1 !== value2) { | ||
result[key] = value2; | ||
} | ||
} | ||
} | ||
|
||
return Object.keys(result).length ? result : null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './get.diff'; |
Oops, something went wrong.