Adjust ADF to latest JS-API version (#8882)

* Bump js-api version

* Fix imports

* Fix content-services unit tests

* Fix process-services unit tests

* [ci:force] Trigger CI

* Fix code smells

* Fix orderBy param

* Fix code smells

* Fix failing unit tests

* Bump js-api version and align with new changes

* Remove dangling coma

* Fix delete return type

* Add correct date format in task filters e2es

* Fix typing in task filter sorting

* Fix activiti content api import

* Add null check for has avatar

* Make User class instead of type

* Fix user type in comment model

* Fix sonar cloud issue

* Type fixes

* Update js-api version
This commit is contained in:
MichalKinas
2023-09-07 13:29:42 +02:00
committed by GitHub
parent 876ca7a0a7
commit 76e2870c66
64 changed files with 628 additions and 884 deletions

View File

@@ -15,14 +15,15 @@
* limitations under the License.
*/
import { User } from '../../../../..';
import { CommentModel } from '../../../models/comment.model';
export const testUser = {
export const testUser = new User({
id: '1',
firstName: 'Test',
lastName: 'User',
email: 'tu@domain.com'
};
});
export const mockCommentOne = new CommentModel({
id: 1,
@@ -42,29 +43,25 @@ export const commentUserPictureDefined = new CommentModel({
id: 2,
message: '2nd Test Comment',
created: new Date(),
createdBy: {
createdBy: new User({
enabled: true,
firstName: 'some',
lastName: 'one',
email: 'some-one@somegroup.com',
emailNotificationsEnabled: true,
company: {},
id: 'fake-email@dom.com',
avatarId: '001-001-001'
}
})
});
export const commentUserNoPictureDefined = new CommentModel({
id: 2,
message: '2nd Test Comment',
created: new Date(),
createdBy: {
createdBy: new User({
enabled: true,
firstName: 'some',
lastName: 'one',
email: 'some-one@somegroup.com',
emailNotificationsEnabled: true,
company: {},
id: 'fake-email@dom.com'
}
})
});

View File

@@ -31,87 +31,35 @@ export class CommentsServiceMock implements Partial<CommentsService> {
}
}
const commentUser = new User({
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
id: 'hruser',
email: 'test'
});
export const commentsResponseMock = {
getComments: () => of([
new CommentModel({
id: 1,
message: 'Test Comment',
created: new Date(),
createdBy: {
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
quota: -1,
quotaUsed: 12,
emailNotificationsEnabled: true,
company: {
organization: 'test',
address1: 'test',
address2: 'test',
address3: 'test',
postcode: 'test',
telephone: 'test',
fax: 'test',
email: 'test'
},
id: 'hruser',
email: 'test',
isAdmin: () => false
} as User,
createdBy: commentUser,
isSelected: false
}),
new CommentModel({
id: 2,
message: 'Test Comment',
created: new Date(),
createdBy: {
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
quota: -1,
quotaUsed: 12,
emailNotificationsEnabled: true,
company: {
organization: 'test',
address1: 'test',
address2: 'test',
address3: 'test',
postcode: 'test',
telephone: 'test',
fax: 'test',
email: 'test'
},
id: 'hruser',
email: 'test',
isAdmin: () => false
} as User,
createdBy: commentUser,
isSelected: false
}),
new CommentModel({
id: 3,
message: 'Test Comment',
created: new Date(),
createdBy: {
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
quota: -1,
quotaUsed: 12,
emailNotificationsEnabled: true,
company: {
organization: 'test',
address1: 'test',
address2: 'test',
address3: 'test',
postcode: 'test',
telephone: 'test',
fax: 'test',
email: 'test'
},
id: 'hruser',
email: 'test',
isAdmin: () => false
} as User,
createdBy: commentUser,
isSelected: false
})
]),
@@ -120,27 +68,7 @@ export const commentsResponseMock = {
id: 1,
message,
created: new Date(),
createdBy: {
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
quota: -1,
quotaUsed: 12,
emailNotificationsEnabled: true,
company: {
organization: 'test',
address1: 'test',
address2: 'test',
address3: 'test',
postcode: 'test',
telephone: 'test',
fax: 'test',
email: 'test'
},
id: 'hruser',
email: 'test',
isAdmin: () => false
} as User,
createdBy: commentUser,
isSelected: false
})
)

View File

@@ -15,11 +15,10 @@
* limitations under the License.
*/
import { CommentModel } from '../../models';
import { CommentModel, User } from '../../models';
import { Observable, of } from 'rxjs';
import { CommentsService } from '../interfaces/comments-service.interface';
import { testUser } from './comments.stories.mock';
import { UserLike } from '../../pipes/user-like.interface';
export class CommentsServiceStoriesMock implements Partial<CommentsService> {
@@ -33,87 +32,35 @@ export class CommentsServiceStoriesMock implements Partial<CommentsService> {
}
}
const commentUser = new User({
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
id: 'hruser',
email: 'test'
});
export const commentsResponseMock = {
getComments: () => of([
new CommentModel({
id: 1,
message: 'Test Comment',
created: new Date(),
createdBy: {
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
quota: -1,
quotaUsed: 12,
emailNotificationsEnabled: true,
company: {
organization: 'test',
address1: 'test',
address2: 'test',
address3: 'test',
postcode: 'test',
telephone: 'test',
fax: 'test',
email: 'test'
},
id: 'hruser',
email: 'test',
isAdmin: () => false
} as UserLike,
createdBy: commentUser,
isSelected: false
}),
new CommentModel({
id: 2,
message: 'Test Comment',
created: new Date(),
createdBy: {
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
quota: -1,
quotaUsed: 12,
emailNotificationsEnabled: true,
company: {
organization: 'test',
address1: 'test',
address2: 'test',
address3: 'test',
postcode: 'test',
telephone: 'test',
fax: 'test',
email: 'test'
},
id: 'hruser',
email: 'test',
isAdmin: () => false
} as UserLike,
createdBy: commentUser,
isSelected: false
}),
new CommentModel({
id: 3,
message: 'Test Comment',
created: new Date(),
createdBy: {
enabled: true,
firstName: 'hruser',
displayName: 'hruser',
quota: -1,
quotaUsed: 12,
emailNotificationsEnabled: true,
company: {
organization: 'test',
address1: 'test',
address2: 'test',
address3: 'test',
postcode: 'test',
telephone: 'test',
fax: 'test',
email: 'test'
},
id: 'hruser',
email: 'test',
isAdmin: () => false
} as UserLike,
createdBy: commentUser,
isSelected: false
})
]),

View File

@@ -18,14 +18,14 @@
import { User } from './general-user.model';
export class CommentModel {
id: number;
id: string | number;
message: string;
created: Date;
createdBy: User;
isSelected: boolean;
get hasAvatarPicture(): boolean {
return !!(this.createdBy['pictureId'] || this.createdBy['avatarId']);
return !!this.createdBy && !!(this.createdBy['pictureId'] || this.createdBy['avatarId']);
}
get userDisplayName(): string {
@@ -51,7 +51,7 @@ export class CommentModel {
return result.toUpperCase();
}
constructor(obj?: any) {
constructor(obj?: Partial<CommentModel>) {
if (obj) {
this.id = obj.id;
this.message = obj.message;

View File

@@ -15,6 +15,23 @@
* limitations under the License.
*/
import { IdentityUserModel } from '../auth/models/identity-user.model';
export class User {
displayName?: string;
username?: string;
id?: string | number;
firstName?: string;
lastName?: string;
email?: string;
createdTimestamp?: any;
emailVerified?: boolean;
enabled?: boolean;
readonly?: boolean;
pictureId?: number;
avatarId: string;
export type User = (IdentityUserModel) & { displayName?: string } & { username?: string };
constructor(user?: Partial<User>) {
if (user) {
Object.assign(this, user);
}
}
};