Skip to content
Snippets Groups Projects
Commit a57afe31 authored by kelly.nguyen's avatar kelly.nguyen
Browse files

add creatingStaticPage to cmd for the resume cmd

parent 14953733
No related branches found
No related tags found
No related merge requests found
......@@ -8,9 +8,9 @@ import path from 'path';
import TextStyle from "../../../types/TextStyle";
import GitlabManager from "../../../managers/GitlabManager";
import User from "../../../sharedByClients/models/User";
import test from "node:test";
type CommandOptions = { id : string, nameFile : string, full : boolean }
// type CommandOptions = { name: string, template?: string, members_id?: Array<number>, members_username?: Array<string>, clone?: string | boolean }
type CommandOptions = { id : string, nameFile : string, full : boolean, test : boolean}
class UserCreateResumeCommand extends CommanderCommand {
protected commandName : string = 'resume';
......@@ -21,8 +21,8 @@ class UserCreateResumeCommand extends CommanderCommand {
.requiredOption('-u, --id <id>', 'id of the user')
.requiredOption('-n, --nameFile <string>', 'path of the file')
.option('--full', 'full export')
.option('--test', 'test command')
.action(this.commandAction.bind(this));
// .action((options) => this.commandAction(options));
}
// protected async commandAction(options: { name: string }): Promise<void> {
protected async commandAction(options : CommandOptions): Promise<void> {
......@@ -42,6 +42,10 @@ class UserCreateResumeCommand extends CommanderCommand {
}).start();
try {
if (options.test) {
const res = await DojoBackendManager.createStaticPage(options.id);
console.log(res);
} else {
const resumeCreated = await DojoBackendManager.createResumeUser(options.id);
if (!resumeCreated) {
......@@ -93,7 +97,7 @@ class UserCreateResumeCommand extends CommanderCommand {
}).catch((error) => {
resumeSpinner.fail(`Error download : ${error}`);
});
}
} catch (error) {
console.log(error);
......
File added
......@@ -291,17 +291,6 @@ class DojoBackendManager {
}
public async createZip(userId : string) {
// return ((await axios.get<DojoBackendResponse<null>>(DojoBackendHelper.getApiUrl(ApiRoute.USER_EXPORTZIP, {
// userId : userId,
// }), {
// responseType: 'stream'
// })).data.data);
// return await axios.get(DojoBackendHelper.getApiUrl(ApiRoute.USER_EXPORTZIP, {
// userId: userId
// }), {
// responseType: 'stream'
// });
const url = DojoBackendHelper.getApiUrl(ApiRoute.USER_EXPORTZIP, {
userId: userId
});
......@@ -312,6 +301,12 @@ class DojoBackendManager {
});
return response;
}
public async createStaticPage(userId : string) {
return ((await axios.get<DojoBackendResponse<null>>(DojoBackendHelper.getApiUrl(ApiRoute.USER_STATICPAGE, {
userId : userId
}))).data.data);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment