Initial commit: Angular frontend and Expressjs backend
This commit is contained in:
22
worklenz-backend/src/models/server-response.ts
Normal file
22
worklenz-backend/src/models/server-response.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export class ServerResponse<T> {
|
||||
public done: boolean;
|
||||
public body: T | null;
|
||||
public title: string | null = null;
|
||||
public message: string | null;
|
||||
|
||||
constructor(done: boolean, body: T, message: string | null = null) {
|
||||
this.done = !!done;
|
||||
this.body = body === null || body === undefined ? null : body;
|
||||
this.message = message?.toString().trim() ?? null;
|
||||
}
|
||||
|
||||
public withTitle(title: string) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public setMessage(message: string) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user