[DEV] update new model generation of Typescript
This commit is contained in:
parent
4d1ae6f795
commit
ad26736b80
@ -25,7 +25,7 @@
|
|||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
services:
|
services:
|
||||||
kar_db_service:
|
db_service:
|
||||||
image: mysql:latest
|
image: mysql:latest
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=base_db_password
|
- MYSQL_ROOT_PASSWORD=base_db_password
|
||||||
volumes: # !!!! the folder is not the default set it on ssh not on long-storage data
|
volumes:
|
||||||
- ./data:/var/lib/mysql
|
- ./data:/var/lib/mysql
|
||||||
#- /workspace/data/global/db:/var/lib/mysql
|
#- /workspace/data/global/db:/var/lib/mysql
|
||||||
mem_limit: 300m
|
mem_limit: 300m
|
||||||
@ -16,13 +16,13 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
start_period: 20s
|
start_period: 20s
|
||||||
|
|
||||||
kar_adminer_service:
|
adminer_service:
|
||||||
image: adminer:latest
|
image: adminer:latest
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 18079:8080
|
- 5079:8080
|
||||||
links:
|
links:
|
||||||
- kar_db_service:db
|
- db_service:db
|
||||||
#read_only: true
|
#read_only: true
|
||||||
mem_limit: 100m
|
mem_limit: 100m
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kangaroo-and-rabbit</groupId>
|
<groupId>kangaroo-and-rabbit</groupId>
|
||||||
<artifactId>archidata</artifactId>
|
<artifactId>archidata</artifactId>
|
||||||
<version>0.8.9</version>
|
<version>0.10.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
@ -36,6 +36,7 @@ import org.kar.karso.filter.KarsoAuthenticationFilter;
|
|||||||
import org.kar.karso.migration.Initialization;
|
import org.kar.karso.migration.Initialization;
|
||||||
import org.kar.karso.migration.Migration20231015;
|
import org.kar.karso.migration.Migration20231015;
|
||||||
import org.kar.karso.migration.Migration20231126;
|
import org.kar.karso.migration.Migration20231126;
|
||||||
|
import org.kar.karso.migration.Migration20240515;
|
||||||
import org.kar.karso.model.Application;
|
import org.kar.karso.model.Application;
|
||||||
import org.kar.karso.model.ApplicationToken;
|
import org.kar.karso.model.ApplicationToken;
|
||||||
import org.kar.karso.model.Right;
|
import org.kar.karso.model.Right;
|
||||||
@ -79,6 +80,7 @@ public class WebLauncher {
|
|||||||
WebLauncher.LOGGER.info("Add migration since last version");
|
WebLauncher.LOGGER.info("Add migration since last version");
|
||||||
migrationEngine.add(new Migration20231015());
|
migrationEngine.add(new Migration20231015());
|
||||||
migrationEngine.add(new Migration20231126());
|
migrationEngine.add(new Migration20231126());
|
||||||
|
migrationEngine.add(new Migration20240515());
|
||||||
WebLauncher.LOGGER.info("Migrate the DB [START]");
|
WebLauncher.LOGGER.info("Migrate the DB [START]");
|
||||||
migrationEngine.migrateWaitAdmin(GlobalConfiguration.dbConfig);
|
migrationEngine.migrateWaitAdmin(GlobalConfiguration.dbConfig);
|
||||||
WebLauncher.LOGGER.info("Migrate the DB [STOP]");
|
WebLauncher.LOGGER.info("Migrate the DB [STOP]");
|
||||||
|
@ -4,7 +4,8 @@ package org.kar.karso;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.kar.archidata.api.DataResource;
|
import org.kar.archidata.api.DataResource;
|
||||||
import org.kar.archidata.dataAccess.DataFactoryTsApi;
|
import org.kar.archidata.externalRestApi.AnalyzeApi;
|
||||||
|
import org.kar.archidata.externalRestApi.TsGenerateApi;
|
||||||
import org.kar.archidata.tools.ConfigBaseVariable;
|
import org.kar.archidata.tools.ConfigBaseVariable;
|
||||||
import org.kar.karso.api.ApplicationResource;
|
import org.kar.karso.api.ApplicationResource;
|
||||||
import org.kar.karso.api.ApplicationTokenResource;
|
import org.kar.karso.api.ApplicationTokenResource;
|
||||||
@ -13,7 +14,6 @@ import org.kar.karso.api.PublicKeyResource;
|
|||||||
import org.kar.karso.api.RightResource;
|
import org.kar.karso.api.RightResource;
|
||||||
import org.kar.karso.api.SystemConfigResource;
|
import org.kar.karso.api.SystemConfigResource;
|
||||||
import org.kar.karso.api.UserResource;
|
import org.kar.karso.api.UserResource;
|
||||||
import org.kar.karso.migration.Initialization;
|
|
||||||
import org.kar.karso.util.ConfigVariable;
|
import org.kar.karso.util.ConfigVariable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -23,11 +23,19 @@ public class WebLauncherLocal extends WebLauncher {
|
|||||||
|
|
||||||
private WebLauncherLocal() {}
|
private WebLauncherLocal() {}
|
||||||
|
|
||||||
|
public static void generateObjects() throws Exception {
|
||||||
|
LOGGER.info("Generate APIs");
|
||||||
|
final List<Class<?>> listOfResources = List.of(Front.class, DataResource.class, ApplicationResource.class,
|
||||||
|
ApplicationTokenResource.class, PublicKeyResource.class, RightResource.class, UserResource.class,
|
||||||
|
SystemConfigResource.class);
|
||||||
|
final AnalyzeApi api = new AnalyzeApi();
|
||||||
|
api.addAllApi(listOfResources);
|
||||||
|
TsGenerateApi.generateApi(api, "../front/src/back-api/");
|
||||||
|
LOGGER.info("Generate APIs (DONE)");
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(final String[] args) throws Exception {
|
public static void main(final String[] args) throws Exception {
|
||||||
DataFactoryTsApi.generatePackage(
|
generateObjects();
|
||||||
List.of(Front.class, DataResource.class, ApplicationResource.class, ApplicationTokenResource.class,
|
|
||||||
PublicKeyResource.class, RightResource.class, UserResource.class, SystemConfigResource.class),
|
|
||||||
Initialization.CLASSES_BASE, "../front/src/back-api/");
|
|
||||||
final WebLauncherLocal launcher = new WebLauncherLocal();
|
final WebLauncherLocal launcher = new WebLauncherLocal();
|
||||||
launcher.process();
|
launcher.process();
|
||||||
LOGGER.info("end-configure the server & wait finish process:");
|
LOGGER.info("end-configure the server & wait finish process:");
|
||||||
|
@ -126,7 +126,8 @@ public class ApplicationResource {
|
|||||||
application.createdAt = null;
|
application.createdAt = null;
|
||||||
application.deleted = null;
|
application.deleted = null;
|
||||||
application.updatedAt = null;
|
application.updatedAt = null;
|
||||||
return DataAccess.insert(application);
|
final Application tmp = DataAccess.insert(application);
|
||||||
|
return get(tmp.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -91,7 +91,7 @@ public class SystemConfigResource {
|
|||||||
public void setKey(
|
public void setKey(
|
||||||
@Context final SecurityContext sc,
|
@Context final SecurityContext sc,
|
||||||
@PathParam("key") final String key,
|
@PathParam("key") final String key,
|
||||||
@AsyncType(Map.class) final String jsonRequest) throws Exception {
|
@AsyncType(Object.class) final String jsonRequest) throws Exception {
|
||||||
Settings res = null;
|
Settings res = null;
|
||||||
try {
|
try {
|
||||||
res = DataAccess.getWhere(Settings.class, new Condition(new QueryCondition("key", "=", key)));
|
res = DataAccess.getWhere(Settings.class, new Condition(new QueryCondition("key", "=", key)));
|
||||||
|
69
back/src/org/kar/karso/migration/Migration20240515.java
Normal file
69
back/src/org/kar/karso/migration/Migration20240515.java
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package org.kar.karso.migration;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.kar.archidata.dataAccess.DataAccess;
|
||||||
|
import org.kar.archidata.dataAccess.options.AccessDeletedItems;
|
||||||
|
import org.kar.archidata.dataAccess.options.OverrideTableName;
|
||||||
|
import org.kar.archidata.migration.MigrationSqlStep;
|
||||||
|
import org.kar.archidata.tools.UuidUtils;
|
||||||
|
import org.kar.karso.migration.model.UUIDConversion;
|
||||||
|
|
||||||
|
public class Migration20240515 extends MigrationSqlStep {
|
||||||
|
|
||||||
|
public static final int KARSO_INITIALISATION_ID = 1;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "migration-2024-05-15: Update the link user application and the cover";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Migration20240515() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateStep() throws Exception {
|
||||||
|
// update migration update (last one)
|
||||||
|
addAction("""
|
||||||
|
ALTER TABLE `user_link_application` ADD `uuid` binary(16) AFTER `id`;
|
||||||
|
""");
|
||||||
|
addAction(() -> {
|
||||||
|
final List<UUIDConversion> datas = DataAccess.gets(UUIDConversion.class, new AccessDeletedItems(),
|
||||||
|
new OverrideTableName("user_link_application"));
|
||||||
|
for (final UUIDConversion elem : datas) {
|
||||||
|
elem.uuid = UuidUtils.nextUUID();
|
||||||
|
}
|
||||||
|
for (final UUIDConversion elem : datas) {
|
||||||
|
DataAccess.update(elem, elem.id, List.of("uuid"), new OverrideTableName("data"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addAction("""
|
||||||
|
ALTER TABLE `user_link_application` DROP PRIMARY KEY;
|
||||||
|
""");
|
||||||
|
addAction("""
|
||||||
|
ALTER TABLE `user_link_application`
|
||||||
|
CHANGE `uuid` `uuid` binary(16) DEFAULT (UUID_TO_BIN(UUID(), TRUE));
|
||||||
|
""");
|
||||||
|
addAction("""
|
||||||
|
ALTER TABLE `user_link_application`
|
||||||
|
ADD PRIMARY KEY `uuid` (`uuid`);
|
||||||
|
""");
|
||||||
|
|
||||||
|
addAction("""
|
||||||
|
ALTER TABLE `user_link_application`
|
||||||
|
ADD `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Deleted state' AFTER `uuid`;
|
||||||
|
""");
|
||||||
|
|
||||||
|
addAction("""
|
||||||
|
DROP TABLE `user_link_cover`;
|
||||||
|
""");
|
||||||
|
|
||||||
|
addAction("""
|
||||||
|
ALTER TABLE `user`
|
||||||
|
ADD `covers` json DEFAULT NULL COMMENT 'List of Id of the specific covers' AFTER `removed`;
|
||||||
|
""");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
back/src/org/kar/karso/migration/model/UUIDConversion.java
Normal file
11
back/src/org/kar/karso/migration/model/UUIDConversion.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package org.kar.karso.migration.model;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
|
||||||
|
public class UUIDConversion {
|
||||||
|
@Id
|
||||||
|
public Long id = null;
|
||||||
|
public UUID uuid = null;
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package org.kar.karso.model;
|
package org.kar.karso.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class AddUserData {
|
public class AddUserData {
|
||||||
public Long userId;
|
public Long userId;
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package org.kar.karso.model;
|
package org.kar.karso.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class ApplicationSmall {
|
public class ApplicationSmall {
|
||||||
public Long id;
|
public Long id;
|
||||||
public String name;
|
public String name;
|
||||||
@ -8,8 +11,7 @@ public class ApplicationSmall {
|
|||||||
|
|
||||||
public ApplicationSmall() {}
|
public ApplicationSmall() {}
|
||||||
|
|
||||||
public ApplicationSmall(Long id, String name, String description, String redirect) {
|
public ApplicationSmall(final Long id, final String name, final String description, final String redirect) {
|
||||||
super();
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package org.kar.karso.model;
|
package org.kar.karso.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class ChangePassword {
|
public class ChangePassword {
|
||||||
@Column(length = 32)
|
@Column(length = 32)
|
||||||
public String method;
|
public String method;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package org.kar.karso.model;
|
package org.kar.karso.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class ClientToken {
|
public class ClientToken {
|
||||||
@Column(length = 1024)
|
@Column(length = 1024)
|
||||||
public String url;
|
public String url;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package org.kar.karso.model;
|
package org.kar.karso.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class CreateTokenRequest {
|
public class CreateTokenRequest {
|
||||||
public CreateTokenRequest() {}
|
public CreateTokenRequest() {}
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public record DataGetToken(
|
public record DataGetToken(
|
||||||
String login,
|
String login,
|
||||||
String method,
|
String method,
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package org.kar.karso.model;
|
package org.kar.karso.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class DataGetTokenApplication {
|
public class DataGetTokenApplication {
|
||||||
public String application;
|
public String application;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ CREATE TABLE `application` (
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import org.kar.archidata.annotation.DataIfNotExists;
|
import org.kar.archidata.annotation.DataIfNotExists;
|
||||||
import org.kar.archidata.model.GenericDataSoftDelete;
|
import org.kar.archidata.model.UUIDGenericDataSoftDelete;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ import jakarta.persistence.Table;
|
|||||||
@Table(name = "user_link_application")
|
@Table(name = "user_link_application")
|
||||||
@DataIfNotExists
|
@DataIfNotExists
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class UserLinkApplication extends GenericDataSoftDelete {
|
public class UserLinkApplication extends UUIDGenericDataSoftDelete {
|
||||||
@Column(name = "object1id")
|
@Column(name = "object1id")
|
||||||
public Long userId;
|
public Long userId;
|
||||||
@Column(name = "object2id")
|
@Column(name = "object2id")
|
||||||
|
@ -21,32 +21,32 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^17.3.8",
|
"@angular/animations": "^18.0.0",
|
||||||
"@angular/cdk": "^17.3.8",
|
"@angular/cdk": "^18.0.0",
|
||||||
"@angular/common": "^17.3.8",
|
"@angular/common": "^18.0.0",
|
||||||
"@angular/compiler": "^17.3.8",
|
"@angular/compiler": "^18.0.0",
|
||||||
"@angular/core": "^17.3.8",
|
"@angular/core": "^18.0.0",
|
||||||
"@angular/forms": "^17.3.8",
|
"@angular/forms": "^18.0.0",
|
||||||
"@angular/material": "^17.3.8",
|
"@angular/material": "^18.0.0",
|
||||||
"@angular/platform-browser": "^17.3.8",
|
"@angular/platform-browser": "^18.0.0",
|
||||||
"@angular/platform-browser-dynamic": "^17.3.8",
|
"@angular/platform-browser-dynamic": "^18.0.0",
|
||||||
"@angular/router": "^17.3.8",
|
"@angular/router": "^18.0.0",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1",
|
||||||
"zone.js": "^0.14.5",
|
"zone.js": "^0.14.6",
|
||||||
"zod": "3.23.8",
|
"zod": "3.23.8",
|
||||||
"@kangaroo-and-rabbit/kar-cw": "^0.3.0"
|
"@kangaroo-and-rabbit/kar-cw": "^0.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^17.3.7",
|
"@angular-devkit/build-angular": "^18.0.1",
|
||||||
"@angular-eslint/builder": "17.4.0",
|
"@angular-eslint/builder": "17.5.2",
|
||||||
"@angular-eslint/eslint-plugin": "17.4.0",
|
"@angular-eslint/eslint-plugin": "17.5.2",
|
||||||
"@angular-eslint/eslint-plugin-template": "17.4.0",
|
"@angular-eslint/eslint-plugin-template": "17.5.2",
|
||||||
"@angular-eslint/schematics": "17.4.0",
|
"@angular-eslint/schematics": "17.5.2",
|
||||||
"@angular-eslint/template-parser": "17.4.0",
|
"@angular-eslint/template-parser": "17.5.2",
|
||||||
"@angular/cli": "^17.3.7",
|
"@angular/cli": "^18.0.1",
|
||||||
"@angular/compiler-cli": "^17.3.8",
|
"@angular/compiler-cli": "^18.0.0",
|
||||||
"@angular/language-service": "^17.3.8",
|
"@angular/language-service": "^18.0.0",
|
||||||
"@playwright/test": "^1.44.0",
|
"@playwright/test": "^1.44.1",
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
"jasmine": "^5.1.0",
|
"jasmine": "^5.1.0",
|
||||||
"jasmine-core": "^5.1.2",
|
"jasmine-core": "^5.1.2",
|
||||||
|
2249
front/pnpm-lock.yaml
2249
front/pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -1,29 +1,31 @@
|
|||||||
/**
|
/**
|
||||||
* API of the server (auto-generated code)
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
HTTPMimeType,
|
HTTPMimeType,
|
||||||
HTTPRequestModel,
|
HTTPRequestModel,
|
||||||
ModelResponseHttp,
|
RESTConfig,
|
||||||
RESTCallbacks,
|
RESTRequestJson,
|
||||||
RESTConfig,
|
RESTRequestVoid,
|
||||||
RESTRequestJson,
|
} from "../rest-tools";
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
import { z as zod } from "zod"
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
import {
|
||||||
AddUserData,
|
AddUserDataWrite,
|
||||||
Application,
|
Application,
|
||||||
ApplicationSmall,
|
ApplicationSmall,
|
||||||
ClientToken,
|
ApplicationWrite,
|
||||||
Long,
|
ClientToken,
|
||||||
RightDescription,
|
Long,
|
||||||
isApplication,
|
RightDescription,
|
||||||
isLong,
|
ZodApplication,
|
||||||
isRightDescription,
|
ZodApplicationSmall,
|
||||||
isApplicationSmall,
|
ZodLong,
|
||||||
isClientToken,
|
ZodRightDescription,
|
||||||
} from "./model"
|
isApplication,
|
||||||
|
isClientToken,
|
||||||
|
} from "../model";
|
||||||
|
|
||||||
export namespace ApplicationResource {
|
export namespace ApplicationResource {
|
||||||
|
|
||||||
export function addUser({
|
export function addUser({
|
||||||
@ -35,7 +37,7 @@ export namespace ApplicationResource {
|
|||||||
params: {
|
params: {
|
||||||
id: Long,
|
id: Long,
|
||||||
},
|
},
|
||||||
data: AddUserData,
|
data: AddUserDataWrite,
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestVoid({
|
||||||
restModel: {
|
restModel: {
|
||||||
@ -53,11 +55,11 @@ export namespace ApplicationResource {
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
data: Application,
|
data: ApplicationWrite,
|
||||||
}): Promise<Application> {
|
}): Promise<Application> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/application",
|
endPoint: "/application/",
|
||||||
requestType: HTTPRequestModel.POST,
|
requestType: HTTPRequestModel.POST,
|
||||||
contentType: HTTPMimeType.JSON,
|
contentType: HTTPMimeType.JSON,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
@ -85,6 +87,20 @@ export namespace ApplicationResource {
|
|||||||
params,
|
params,
|
||||||
}, isApplication);
|
}, isApplication);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetApplicationUsersTypeReturn = zod.array(ZodLong);
|
||||||
|
export type GetApplicationUsersTypeReturn = zod.infer<typeof ZodGetApplicationUsersTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetApplicationUsersTypeReturn(data: any): data is GetApplicationUsersTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetApplicationUsersTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetApplicationUsersTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getApplicationUsers({
|
export function getApplicationUsers({
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
@ -93,8 +109,8 @@ export namespace ApplicationResource {
|
|||||||
params: {
|
params: {
|
||||||
id: Long,
|
id: Long,
|
||||||
},
|
},
|
||||||
}): Promise<Long[]> {
|
}): Promise<GetApplicationUsersTypeReturn> {
|
||||||
return RESTRequestJsonArray({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/application/{id}/users",
|
endPoint: "/application/{id}/users",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
@ -102,21 +118,35 @@ export namespace ApplicationResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
}, isLong);
|
}, isGetApplicationUsersTypeReturn);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetApplicationsSmallTypeReturn = zod.array(ZodApplicationSmall);
|
||||||
|
export type GetApplicationsSmallTypeReturn = zod.infer<typeof ZodGetApplicationsSmallTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetApplicationsSmallTypeReturn(data: any): data is GetApplicationsSmallTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetApplicationsSmallTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetApplicationsSmallTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getApplicationsSmall({
|
export function getApplicationsSmall({
|
||||||
restConfig,
|
restConfig,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
}): Promise<ApplicationSmall[]> {
|
}): Promise<GetApplicationsSmallTypeReturn> {
|
||||||
return RESTRequestJsonArray({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/application/small",
|
endPoint: "/application/small",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
}, isApplicationSmall);
|
}, isGetApplicationsSmallTypeReturn);
|
||||||
};
|
};
|
||||||
export function getClientToken({
|
export function getClientToken({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -137,6 +167,20 @@ export namespace ApplicationResource {
|
|||||||
queries,
|
queries,
|
||||||
}, isClientToken);
|
}, isClientToken);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetRightsDescriptionTypeReturn = zod.array(ZodRightDescription);
|
||||||
|
export type GetRightsDescriptionTypeReturn = zod.infer<typeof ZodGetRightsDescriptionTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetRightsDescriptionTypeReturn(data: any): data is GetRightsDescriptionTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetRightsDescriptionTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetRightsDescriptionTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getRightsDescription({
|
export function getRightsDescription({
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
@ -145,8 +189,8 @@ export namespace ApplicationResource {
|
|||||||
params: {
|
params: {
|
||||||
id: Long,
|
id: Long,
|
||||||
},
|
},
|
||||||
}): Promise<RightDescription[]> {
|
}): Promise<GetRightsDescriptionTypeReturn> {
|
||||||
return RESTRequestJsonArray({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/application/{id}/rights",
|
endPoint: "/application/{id}/rights",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
@ -154,21 +198,35 @@ export namespace ApplicationResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
}, isRightDescription);
|
}, isGetRightsDescriptionTypeReturn);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetsTypeReturn = zod.array(ZodApplication);
|
||||||
|
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetsTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function gets({
|
export function gets({
|
||||||
restConfig,
|
restConfig,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
}): Promise<Application[]> {
|
}): Promise<GetsTypeReturn> {
|
||||||
return RESTRequestJsonArray({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/application",
|
endPoint: "/application/",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
}, isApplication);
|
}, isGetsTypeReturn);
|
||||||
};
|
};
|
||||||
export function logOut({
|
export function logOut({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -187,7 +245,7 @@ export namespace ApplicationResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
queries,
|
queries,
|
||||||
}, null);
|
});
|
||||||
};
|
};
|
||||||
export function patch({
|
export function patch({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -198,7 +256,7 @@ export namespace ApplicationResource {
|
|||||||
params: {
|
params: {
|
||||||
id: Long,
|
id: Long,
|
||||||
},
|
},
|
||||||
data: Application,
|
data: ApplicationWrite,
|
||||||
}): Promise<Application> {
|
}): Promise<Application> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
@ -1,23 +1,24 @@
|
|||||||
/**
|
/**
|
||||||
* API of the server (auto-generated code)
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
HTTPMimeType,
|
HTTPMimeType,
|
||||||
HTTPRequestModel,
|
HTTPRequestModel,
|
||||||
ModelResponseHttp,
|
RESTConfig,
|
||||||
RESTCallbacks,
|
RESTRequestJson,
|
||||||
RESTConfig,
|
RESTRequestVoid,
|
||||||
RESTRequestJson,
|
} from "../rest-tools";
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
import { z as zod } from "zod"
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
import {
|
||||||
ApplicationToken,
|
ApplicationToken,
|
||||||
CreateTokenRequest,
|
CreateTokenRequestWrite,
|
||||||
Integer,
|
Integer,
|
||||||
Long,
|
Long,
|
||||||
isApplicationToken,
|
ZodApplicationToken,
|
||||||
} from "./model"
|
isApplicationToken,
|
||||||
|
} from "../model";
|
||||||
|
|
||||||
export namespace ApplicationTokenResource {
|
export namespace ApplicationTokenResource {
|
||||||
|
|
||||||
export function create({
|
export function create({
|
||||||
@ -29,7 +30,7 @@ export namespace ApplicationTokenResource {
|
|||||||
params: {
|
params: {
|
||||||
applicationId: Long,
|
applicationId: Long,
|
||||||
},
|
},
|
||||||
data: CreateTokenRequest,
|
data: CreateTokenRequestWrite,
|
||||||
}): Promise<ApplicationToken> {
|
}): Promise<ApplicationToken> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
@ -43,6 +44,20 @@ export namespace ApplicationTokenResource {
|
|||||||
data,
|
data,
|
||||||
}, isApplicationToken);
|
}, isApplicationToken);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetsTypeReturn = zod.array(ZodApplicationToken);
|
||||||
|
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetsTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function gets({
|
export function gets({
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
@ -51,8 +66,8 @@ export namespace ApplicationTokenResource {
|
|||||||
params: {
|
params: {
|
||||||
applicationId: Long,
|
applicationId: Long,
|
||||||
},
|
},
|
||||||
}): Promise<ApplicationToken[]> {
|
}): Promise<GetsTypeReturn> {
|
||||||
return RESTRequestJsonArray({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/application_token/{applicationId}",
|
endPoint: "/application_token/{applicationId}",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
@ -60,7 +75,7 @@ export namespace ApplicationTokenResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
}, isApplicationToken);
|
}, isGetsTypeReturn);
|
||||||
};
|
};
|
||||||
export function remove({
|
export function remove({
|
||||||
restConfig,
|
restConfig,
|
@ -1,25 +1,23 @@
|
|||||||
/**
|
/**
|
||||||
* API of the server (auto-generated code)
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
HTTPMimeType,
|
HTTPMimeType,
|
||||||
HTTPRequestModel,
|
HTTPRequestModel,
|
||||||
ModelResponseHttp,
|
RESTConfig,
|
||||||
RESTCallbacks,
|
RESTRequestJson,
|
||||||
RESTConfig,
|
RESTRequestVoid,
|
||||||
RESTRequestJson,
|
} from "../rest-tools";
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
import {
|
||||||
UUID,
|
UUID,
|
||||||
} from "./model"
|
} from "../model";
|
||||||
|
|
||||||
export namespace DataResource {
|
export namespace DataResource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get back some data from the data environment (with a beautiful name (permit download with basic name)
|
* Get back some data from the data environment (with a beautiful name (permit download with basic name)
|
||||||
*/
|
*/
|
||||||
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
|
|
||||||
export function retrieveDataFull({
|
export function retrieveDataFull({
|
||||||
restConfig,
|
restConfig,
|
||||||
queries,
|
queries,
|
||||||
@ -35,8 +33,8 @@ export namespace DataResource {
|
|||||||
uuid: UUID,
|
uuid: UUID,
|
||||||
},
|
},
|
||||||
data: string,
|
data: string,
|
||||||
}): Promise<void> {
|
}): Promise<object> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/data/{uuid}/{name}",
|
endPoint: "/data/{uuid}/{name}",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
@ -50,7 +48,6 @@ export namespace DataResource {
|
|||||||
/**
|
/**
|
||||||
* Get back some data from the data environment
|
* Get back some data from the data environment
|
||||||
*/
|
*/
|
||||||
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
|
|
||||||
export function retrieveDataId({
|
export function retrieveDataId({
|
||||||
restConfig,
|
restConfig,
|
||||||
queries,
|
queries,
|
||||||
@ -65,8 +62,8 @@ export namespace DataResource {
|
|||||||
uuid: UUID,
|
uuid: UUID,
|
||||||
},
|
},
|
||||||
data: string,
|
data: string,
|
||||||
}): Promise<void> {
|
}): Promise<object> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/data/{uuid}",
|
endPoint: "/data/{uuid}",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
@ -80,7 +77,6 @@ export namespace DataResource {
|
|||||||
/**
|
/**
|
||||||
* Get a thumbnail of from the data environment (if resize is possible)
|
* Get a thumbnail of from the data environment (if resize is possible)
|
||||||
*/
|
*/
|
||||||
// TODO: unmanaged "Response" type: please specify @AsyncType or considered as 'void'.
|
|
||||||
export function retrieveDataThumbnailId({
|
export function retrieveDataThumbnailId({
|
||||||
restConfig,
|
restConfig,
|
||||||
queries,
|
queries,
|
||||||
@ -95,8 +91,8 @@ export namespace DataResource {
|
|||||||
uuid: UUID,
|
uuid: UUID,
|
||||||
},
|
},
|
||||||
data: string,
|
data: string,
|
||||||
}): Promise<void> {
|
}): Promise<object> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/data/thumbnail/{uuid}",
|
endPoint: "/data/thumbnail/{uuid}",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
6
front/src/back-api/api/front.ts
Normal file
6
front/src/back-api/api/front.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
export namespace Front {
|
||||||
|
|
||||||
|
}
|
11
front/src/back-api/api/index.ts
Normal file
11
front/src/back-api/api/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
export * from "./application-resource"
|
||||||
|
export * from "./application-token-resource"
|
||||||
|
export * from "./data-resource"
|
||||||
|
export * from "./front"
|
||||||
|
export * from "./public-key-resource"
|
||||||
|
export * from "./right-resource"
|
||||||
|
export * from "./system-config-resource"
|
||||||
|
export * from "./user-resource"
|
@ -1,20 +1,18 @@
|
|||||||
/**
|
/**
|
||||||
* API of the server (auto-generated code)
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
HTTPMimeType,
|
HTTPMimeType,
|
||||||
HTTPRequestModel,
|
HTTPRequestModel,
|
||||||
ModelResponseHttp,
|
RESTConfig,
|
||||||
RESTCallbacks,
|
RESTRequestJson,
|
||||||
RESTConfig,
|
} from "../rest-tools";
|
||||||
RESTRequestJson,
|
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
import {
|
||||||
PublicKey,
|
PublicKey,
|
||||||
isPublicKey,
|
isPublicKey,
|
||||||
} from "./model"
|
} from "../model";
|
||||||
|
|
||||||
export namespace PublicKeyResource {
|
export namespace PublicKeyResource {
|
||||||
|
|
||||||
export function getKey({
|
export function getKey({
|
||||||
@ -24,7 +22,7 @@ export namespace PublicKeyResource {
|
|||||||
}): Promise<PublicKey> {
|
}): Promise<PublicKey> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/public_key",
|
endPoint: "/public_key/",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
},
|
},
|
||||||
@ -43,6 +41,6 @@ export namespace PublicKeyResource {
|
|||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
}, null);
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -1,21 +1,23 @@
|
|||||||
/**
|
/**
|
||||||
* API of the server (auto-generated code)
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
HTTPMimeType,
|
HTTPMimeType,
|
||||||
HTTPRequestModel,
|
HTTPRequestModel,
|
||||||
ModelResponseHttp,
|
RESTConfig,
|
||||||
RESTCallbacks,
|
RESTRequestJson,
|
||||||
RESTConfig,
|
RESTRequestVoid,
|
||||||
RESTRequestJson,
|
} from "../rest-tools";
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
import { z as zod } from "zod"
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
import {
|
||||||
Long,
|
Long,
|
||||||
Right,
|
Right,
|
||||||
isRight,
|
RightWrite,
|
||||||
} from "./model"
|
ZodRight,
|
||||||
|
isRight,
|
||||||
|
} from "../model";
|
||||||
|
|
||||||
export namespace RightResource {
|
export namespace RightResource {
|
||||||
|
|
||||||
export function get({
|
export function get({
|
||||||
@ -37,19 +39,33 @@ export namespace RightResource {
|
|||||||
params,
|
params,
|
||||||
}, isRight);
|
}, isRight);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetsTypeReturn = zod.array(ZodRight);
|
||||||
|
export type GetsTypeReturn = zod.infer<typeof ZodGetsTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetsTypeReturn(data: any): data is GetsTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetsTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetsTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function gets({
|
export function gets({
|
||||||
restConfig,
|
restConfig,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
}): Promise<Right[]> {
|
}): Promise<GetsTypeReturn> {
|
||||||
return RESTRequestJsonArray({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/right",
|
endPoint: "/right/",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
}, isRight);
|
}, isGetsTypeReturn);
|
||||||
};
|
};
|
||||||
export function patch({
|
export function patch({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -60,7 +76,7 @@ export namespace RightResource {
|
|||||||
params: {
|
params: {
|
||||||
id: Long,
|
id: Long,
|
||||||
},
|
},
|
||||||
data: Right,
|
data: RightWrite,
|
||||||
}): Promise<Right> {
|
}): Promise<Right> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
@ -79,11 +95,11 @@ export namespace RightResource {
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
data: Right,
|
data: RightWrite,
|
||||||
}): Promise<Right> {
|
}): Promise<Right> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/right",
|
endPoint: "/right/",
|
||||||
requestType: HTTPRequestModel.POST,
|
requestType: HTTPRequestModel.POST,
|
||||||
contentType: HTTPMimeType.JSON,
|
contentType: HTTPMimeType.JSON,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
@ -1,22 +1,36 @@
|
|||||||
/**
|
/**
|
||||||
* API of the server (auto-generated code)
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
HTTPMimeType,
|
HTTPMimeType,
|
||||||
HTTPRequestModel,
|
HTTPRequestModel,
|
||||||
ModelResponseHttp,
|
RESTConfig,
|
||||||
RESTCallbacks,
|
RESTRequestJson,
|
||||||
RESTConfig,
|
RESTRequestVoid,
|
||||||
RESTRequestJson,
|
} from "../rest-tools";
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
import { z as zod } from "zod"
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
import {
|
||||||
GetSignUpAvailable,
|
GetSignUpAvailable,
|
||||||
isGetSignUpAvailable,
|
isGetSignUpAvailable,
|
||||||
} from "./model"
|
} from "../model";
|
||||||
|
|
||||||
export namespace SystemConfigResource {
|
export namespace SystemConfigResource {
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodGetKeyTypeReturn = zod.record(zod.string(), zod.any());
|
||||||
|
export type GetKeyTypeReturn = zod.infer<typeof ZodGetKeyTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetKeyTypeReturn(data: any): data is GetKeyTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetKeyTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetKeyTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getKey({
|
export function getKey({
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
@ -25,7 +39,7 @@ export namespace SystemConfigResource {
|
|||||||
params: {
|
params: {
|
||||||
key: string,
|
key: string,
|
||||||
},
|
},
|
||||||
}): Promise<any> {
|
}): Promise<GetKeyTypeReturn> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/system_config/key/{key}",
|
endPoint: "/system_config/key/{key}",
|
||||||
@ -34,7 +48,7 @@ export namespace SystemConfigResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
}, null);
|
}, isGetKeyTypeReturn);
|
||||||
};
|
};
|
||||||
export function isSignUpAvailable({
|
export function isSignUpAvailable({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -59,7 +73,7 @@ export namespace SystemConfigResource {
|
|||||||
params: {
|
params: {
|
||||||
key: string,
|
key: string,
|
||||||
},
|
},
|
||||||
data: any,
|
data: object,
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestVoid({
|
||||||
restModel: {
|
restModel: {
|
@ -1,30 +1,31 @@
|
|||||||
/**
|
/**
|
||||||
* API of the server (auto-generated code)
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
HTTPMimeType,
|
HTTPMimeType,
|
||||||
HTTPRequestModel,
|
HTTPRequestModel,
|
||||||
ModelResponseHttp,
|
RESTConfig,
|
||||||
RESTCallbacks,
|
RESTRequestJson,
|
||||||
RESTConfig,
|
RESTRequestVoid,
|
||||||
RESTRequestJson,
|
} from "../rest-tools";
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
import { z as zod } from "zod"
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
import {
|
||||||
ChangePassword,
|
ChangePasswordWrite,
|
||||||
DataGetToken,
|
DataGetTokenWrite,
|
||||||
GetToken,
|
GetToken,
|
||||||
Long,
|
Long,
|
||||||
UserAuth,
|
UserAuth,
|
||||||
UserAuthGet,
|
UserAuthGet,
|
||||||
UserCreate,
|
UserCreateWrite,
|
||||||
UserOut,
|
UserOut,
|
||||||
isGetToken,
|
ZodUserAuthGet,
|
||||||
isUserAuth,
|
isGetToken,
|
||||||
isUserOut,
|
isUserAuth,
|
||||||
isUserAuthGet,
|
isUserAuthGet,
|
||||||
} from "./model"
|
isUserOut,
|
||||||
|
} from "../model";
|
||||||
|
|
||||||
export namespace UserResource {
|
export namespace UserResource {
|
||||||
|
|
||||||
export function changePassword({
|
export function changePassword({
|
||||||
@ -32,7 +33,7 @@ export namespace UserResource {
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
data: ChangePassword,
|
data: ChangePasswordWrite,
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return RESTRequestVoid({
|
return RESTRequestVoid({
|
||||||
restModel: {
|
restModel: {
|
||||||
@ -49,11 +50,11 @@ export namespace UserResource {
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
data: UserCreate,
|
data: UserCreateWrite,
|
||||||
}): Promise<UserAuthGet> {
|
}): Promise<UserAuthGet> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/users",
|
endPoint: "/users/",
|
||||||
requestType: HTTPRequestModel.POST,
|
requestType: HTTPRequestModel.POST,
|
||||||
contentType: HTTPMimeType.JSON,
|
contentType: HTTPMimeType.JSON,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
@ -62,6 +63,20 @@ export namespace UserResource {
|
|||||||
data,
|
data,
|
||||||
}, isUserAuthGet);
|
}, isUserAuthGet);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetApplicationRightTypeReturn = zod.record(zod.string(), zod.any());
|
||||||
|
export type GetApplicationRightTypeReturn = zod.infer<typeof ZodGetApplicationRightTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetApplicationRightTypeReturn(data: any): data is GetApplicationRightTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetApplicationRightTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetApplicationRightTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getApplicationRight({
|
export function getApplicationRight({
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
@ -71,7 +86,7 @@ export namespace UserResource {
|
|||||||
applicationId: Long,
|
applicationId: Long,
|
||||||
userId: Long,
|
userId: Long,
|
||||||
},
|
},
|
||||||
}): Promise<any> {
|
}): Promise<GetApplicationRightTypeReturn> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/users/{userId}/application/{applicationId}/rights",
|
endPoint: "/users/{userId}/application/{applicationId}/rights",
|
||||||
@ -80,7 +95,7 @@ export namespace UserResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
}, null);
|
}, isGetApplicationRightTypeReturn);
|
||||||
};
|
};
|
||||||
export function getMe({
|
export function getMe({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -101,7 +116,7 @@ export namespace UserResource {
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
data: DataGetToken,
|
data: DataGetTokenWrite,
|
||||||
}): Promise<GetToken> {
|
}): Promise<GetToken> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
@ -133,19 +148,33 @@ export namespace UserResource {
|
|||||||
params,
|
params,
|
||||||
}, isUserAuthGet);
|
}, isUserAuthGet);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodGetUsersTypeReturn = zod.array(ZodUserAuthGet);
|
||||||
|
export type GetUsersTypeReturn = zod.infer<typeof ZodGetUsersTypeReturn>;
|
||||||
|
|
||||||
|
export function isGetUsersTypeReturn(data: any): data is GetUsersTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodGetUsersTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetUsersTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getUsers({
|
export function getUsers({
|
||||||
restConfig,
|
restConfig,
|
||||||
}: {
|
}: {
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig,
|
||||||
}): Promise<UserAuthGet[]> {
|
}): Promise<GetUsersTypeReturn> {
|
||||||
return RESTRequestJsonArray({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/users",
|
endPoint: "/users/",
|
||||||
requestType: HTTPRequestModel.GET,
|
requestType: HTTPRequestModel.GET,
|
||||||
accept: HTTPMimeType.JSON,
|
accept: HTTPMimeType.JSON,
|
||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
}, isUserAuthGet);
|
}, isGetUsersTypeReturn);
|
||||||
};
|
};
|
||||||
export function isEmailExist({
|
export function isEmailExist({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -164,7 +193,7 @@ export namespace UserResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
queries,
|
queries,
|
||||||
}, null);
|
});
|
||||||
};
|
};
|
||||||
export function isLoginExist({
|
export function isLoginExist({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -183,7 +212,7 @@ export namespace UserResource {
|
|||||||
},
|
},
|
||||||
restConfig,
|
restConfig,
|
||||||
queries,
|
queries,
|
||||||
}, null);
|
});
|
||||||
};
|
};
|
||||||
export function linkApplication({
|
export function linkApplication({
|
||||||
restConfig,
|
restConfig,
|
||||||
@ -208,6 +237,20 @@ export namespace UserResource {
|
|||||||
data,
|
data,
|
||||||
}, isUserAuth);
|
}, isUserAuth);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ZodPatchApplicationRightTypeReturn = zod.record(zod.string(), zod.any());
|
||||||
|
export type PatchApplicationRightTypeReturn = zod.infer<typeof ZodPatchApplicationRightTypeReturn>;
|
||||||
|
|
||||||
|
export function isPatchApplicationRightTypeReturn(data: any): data is PatchApplicationRightTypeReturn {
|
||||||
|
try {
|
||||||
|
ZodPatchApplicationRightTypeReturn.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodPatchApplicationRightTypeReturn' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function patchApplicationRight({
|
export function patchApplicationRight({
|
||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
@ -218,8 +261,8 @@ export namespace UserResource {
|
|||||||
applicationId: Long,
|
applicationId: Long,
|
||||||
userId: Long,
|
userId: Long,
|
||||||
},
|
},
|
||||||
data: any,
|
data: {[key: string]: object;},
|
||||||
}): Promise<any> {
|
}): Promise<PatchApplicationRightTypeReturn> {
|
||||||
return RESTRequestJson({
|
return RESTRequestJson({
|
||||||
restModel: {
|
restModel: {
|
||||||
endPoint: "/users/{userId}/application/{applicationId}/rights",
|
endPoint: "/users/{userId}/application/{applicationId}/rights",
|
||||||
@ -230,7 +273,7 @@ export namespace UserResource {
|
|||||||
restConfig,
|
restConfig,
|
||||||
params,
|
params,
|
||||||
data,
|
data,
|
||||||
}, null);
|
}, isPatchApplicationRightTypeReturn);
|
||||||
};
|
};
|
||||||
export function setAdmin({
|
export function setAdmin({
|
||||||
restConfig,
|
restConfig,
|
@ -1,18 +0,0 @@
|
|||||||
/**
|
|
||||||
* API of the server (auto-generated code)
|
|
||||||
*/
|
|
||||||
import {
|
|
||||||
HTTPMimeType,
|
|
||||||
HTTPRequestModel,
|
|
||||||
ModelResponseHttp,
|
|
||||||
RESTCallbacks,
|
|
||||||
RESTConfig,
|
|
||||||
RESTRequestJson,
|
|
||||||
RESTRequestJsonArray,
|
|
||||||
RESTRequestVoid
|
|
||||||
} from "./rest-tools"
|
|
||||||
import {
|
|
||||||
} from "./model"
|
|
||||||
export namespace Front {
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Global import of the package
|
* Interface of the server (auto-generated code)
|
||||||
*/
|
*/
|
||||||
export * from "./model";
|
export * from "./model";
|
||||||
export * from "./front";
|
export * from "./api";
|
||||||
export * from "./data-resource";
|
export * from "./rest-tools";
|
||||||
export * from "./application-resource";
|
|
||||||
export * from "./application-token-resource";
|
|
||||||
export * from "./public-key-resource";
|
|
||||||
export * from "./right-resource";
|
|
||||||
export * from "./user-resource";
|
|
||||||
export * from "./system-config-resource";
|
|
||||||
|
@ -1,549 +0,0 @@
|
|||||||
/**
|
|
||||||
* Interface of the server (auto-generated code)
|
|
||||||
*/
|
|
||||||
import { z as zod } from "zod";
|
|
||||||
|
|
||||||
export const ZodUUID = zod.string().uuid();
|
|
||||||
export type UUID = zod.infer<typeof ZodUUID>;
|
|
||||||
export function isUUID(data: any): data is UUID {
|
|
||||||
try {
|
|
||||||
ZodUUID.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodLong = zod.number();
|
|
||||||
export type Long = zod.infer<typeof ZodLong>;
|
|
||||||
export function isLong(data: any): data is Long {
|
|
||||||
try {
|
|
||||||
ZodLong.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodInteger = zod.number().safe();
|
|
||||||
export type Integer = zod.infer<typeof ZodInteger>;
|
|
||||||
export function isInteger(data: any): data is Integer {
|
|
||||||
try {
|
|
||||||
ZodInteger.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodFloat = zod.number();
|
|
||||||
export type Float = zod.infer<typeof ZodFloat>;
|
|
||||||
export function isFloat(data: any): data is Float {
|
|
||||||
try {
|
|
||||||
ZodFloat.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodInstant = zod.string();
|
|
||||||
export type Instant = zod.infer<typeof ZodInstant>;
|
|
||||||
export function isInstant(data: any): data is Instant {
|
|
||||||
try {
|
|
||||||
ZodInstant.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodDate = zod.string().datetime({ precision: 3 });
|
|
||||||
export type Date = zod.infer<typeof ZodDate>;
|
|
||||||
export function isDate(data: any): data is Date {
|
|
||||||
try {
|
|
||||||
ZodDate.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodTimestamp = zod.string().datetime({ precision: 3 });
|
|
||||||
export type Timestamp = zod.infer<typeof ZodTimestamp>;
|
|
||||||
export function isTimestamp(data: any): data is Timestamp {
|
|
||||||
try {
|
|
||||||
ZodTimestamp.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodLocalDate = zod.string().date();
|
|
||||||
export type LocalDate = zod.infer<typeof ZodLocalDate>;
|
|
||||||
export function isLocalDate(data: any): data is LocalDate {
|
|
||||||
try {
|
|
||||||
ZodLocalDate.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodLocalTime = zod.string().time();
|
|
||||||
export type LocalTime = zod.infer<typeof ZodLocalTime>;
|
|
||||||
export function isLocalTime(data: any): data is LocalTime {
|
|
||||||
try {
|
|
||||||
ZodLocalTime.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodRestErrorResponse = zod.object({
|
|
||||||
uuid: ZodUUID.optional(),
|
|
||||||
name: zod.string().max(255).optional(),
|
|
||||||
message: zod.string().max(255).optional(),
|
|
||||||
time: zod.string().max(255).optional(),
|
|
||||||
status: ZodInteger,
|
|
||||||
statusMessage: zod.string().max(255).optional()
|
|
||||||
});
|
|
||||||
export type RestErrorResponse = zod.infer<typeof ZodRestErrorResponse>;
|
|
||||||
export function isRestErrorResponse(data: any): data is RestErrorResponse {
|
|
||||||
try {
|
|
||||||
ZodRestErrorResponse.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodAddUserData = zod.object({
|
|
||||||
userId: ZodLong.optional()
|
|
||||||
});
|
|
||||||
export type AddUserData = zod.infer<typeof ZodAddUserData>;
|
|
||||||
export function isAddUserData(data: any): data is AddUserData {
|
|
||||||
try {
|
|
||||||
ZodAddUserData.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodGenericTiming = zod.object({
|
|
||||||
// Create time of the object
|
|
||||||
createdAt: ZodDate.readonly().optional(),
|
|
||||||
// When update the object
|
|
||||||
updatedAt: ZodDate.readonly().optional()
|
|
||||||
});
|
|
||||||
export type GenericTiming = zod.infer<typeof ZodGenericTiming>;
|
|
||||||
export function isGenericTiming(data: any): data is GenericTiming {
|
|
||||||
try {
|
|
||||||
ZodGenericTiming.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodGenericData = ZodGenericTiming.extend({
|
|
||||||
// Unique Id of the object
|
|
||||||
id: ZodLong.readonly().optional()
|
|
||||||
});
|
|
||||||
export type GenericData = zod.infer<typeof ZodGenericData>;
|
|
||||||
export function isGenericData(data: any): data is GenericData {
|
|
||||||
try {
|
|
||||||
ZodGenericData.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodGenericDataSoftDelete = ZodGenericData.extend({
|
|
||||||
// Deleted state
|
|
||||||
deleted: zod.boolean().readonly().optional()
|
|
||||||
});
|
|
||||||
export type GenericDataSoftDelete = zod.infer<typeof ZodGenericDataSoftDelete>;
|
|
||||||
export function isGenericDataSoftDelete(data: any): data is GenericDataSoftDelete {
|
|
||||||
try {
|
|
||||||
ZodGenericDataSoftDelete.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodApplication = ZodGenericDataSoftDelete.extend({
|
|
||||||
name: zod.string().max(256).optional(),
|
|
||||||
description: zod.string().max(2048).optional(),
|
|
||||||
redirect: zod.string().max(2048).optional(),
|
|
||||||
redirectDev: zod.string().max(2048).optional(),
|
|
||||||
notification: zod.string().max(2048).optional(),
|
|
||||||
// Expiration time
|
|
||||||
ttl: ZodInteger.optional(),
|
|
||||||
// Right is manage with Karso
|
|
||||||
manageRight: zod.boolean().optional()
|
|
||||||
});
|
|
||||||
export type Application = zod.infer<typeof ZodApplication>;
|
|
||||||
export function isApplication(data: any): data is Application {
|
|
||||||
try {
|
|
||||||
ZodApplication.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodApplicationSmall = zod.object({
|
|
||||||
id: ZodLong.optional(),
|
|
||||||
name: zod.string().max(255).optional(),
|
|
||||||
description: zod.string().max(255).optional(),
|
|
||||||
redirect: zod.string().max(255).optional()
|
|
||||||
});
|
|
||||||
export type ApplicationSmall = zod.infer<typeof ZodApplicationSmall>;
|
|
||||||
export function isApplicationSmall(data: any): data is ApplicationSmall {
|
|
||||||
try {
|
|
||||||
ZodApplicationSmall.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodClientToken = zod.object({
|
|
||||||
url: zod.string().max(1024).optional(),
|
|
||||||
jwt: zod.string().optional()
|
|
||||||
});
|
|
||||||
export type ClientToken = zod.infer<typeof ZodClientToken>;
|
|
||||||
export function isClientToken(data: any): data is ClientToken {
|
|
||||||
try {
|
|
||||||
ZodClientToken.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodRightDescription = ZodGenericDataSoftDelete.extend({
|
|
||||||
// Application id that have the reference of the right
|
|
||||||
applicationId: ZodLong.optional(),
|
|
||||||
// Key of the property
|
|
||||||
key: zod.string().max(64).optional(),
|
|
||||||
// Title of the right
|
|
||||||
title: zod.string().max(1024).optional(),
|
|
||||||
// Description of the right
|
|
||||||
description: zod.string().max(1024).optional(),
|
|
||||||
// default value if Never set
|
|
||||||
defaultValue: zod.string().max(1024).optional(),
|
|
||||||
// Type of the property
|
|
||||||
type: zod.string().max(16).optional()
|
|
||||||
});
|
|
||||||
export type RightDescription = zod.infer<typeof ZodRightDescription>;
|
|
||||||
export function isRightDescription(data: any): data is RightDescription {
|
|
||||||
try {
|
|
||||||
ZodRightDescription.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodGenericToken = ZodGenericDataSoftDelete.extend({
|
|
||||||
parentId: ZodLong.optional(),
|
|
||||||
name: zod.string().optional(),
|
|
||||||
endValidityTime: ZodTimestamp.optional(),
|
|
||||||
token: zod.string().optional()
|
|
||||||
});
|
|
||||||
export type GenericToken = zod.infer<typeof ZodGenericToken>;
|
|
||||||
export function isGenericToken(data: any): data is GenericToken {
|
|
||||||
try {
|
|
||||||
ZodGenericToken.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodApplicationToken = ZodGenericToken.extend({
|
|
||||||
});
|
|
||||||
export type ApplicationToken = zod.infer<typeof ZodApplicationToken>;
|
|
||||||
export function isApplicationToken(data: any): data is ApplicationToken {
|
|
||||||
try {
|
|
||||||
ZodApplicationToken.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodCreateTokenRequest = zod.object({
|
|
||||||
name: zod.string().max(255).optional(),
|
|
||||||
validity: ZodInteger.optional()
|
|
||||||
});
|
|
||||||
export type CreateTokenRequest = zod.infer<typeof ZodCreateTokenRequest>;
|
|
||||||
export function isCreateTokenRequest(data: any): data is CreateTokenRequest {
|
|
||||||
try {
|
|
||||||
ZodCreateTokenRequest.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodPublicKey = zod.object({
|
|
||||||
key: zod.string().max(255).optional()
|
|
||||||
});
|
|
||||||
export type PublicKey = zod.infer<typeof ZodPublicKey>;
|
|
||||||
export function isPublicKey(data: any): data is PublicKey {
|
|
||||||
try {
|
|
||||||
ZodPublicKey.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodRight = ZodGenericDataSoftDelete.extend({
|
|
||||||
// application-ID that have the reference of the right
|
|
||||||
applicationId: ZodLong.optional(),
|
|
||||||
// user-ID
|
|
||||||
userId: ZodLong.optional(),
|
|
||||||
// rightDescription-ID of the right description
|
|
||||||
rightDescriptionId: ZodLong.optional(),
|
|
||||||
// Value of the right
|
|
||||||
value: zod.string().max(1024).optional()
|
|
||||||
});
|
|
||||||
export type Right = zod.infer<typeof ZodRight>;
|
|
||||||
export function isRight(data: any): data is Right {
|
|
||||||
try {
|
|
||||||
ZodRight.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodChangePassword = zod.object({
|
|
||||||
method: zod.string().max(32).optional(),
|
|
||||||
login: zod.string().max(512).optional(),
|
|
||||||
time: zod.string().max(64).optional(),
|
|
||||||
password: zod.string().max(128).optional(),
|
|
||||||
newPassword: zod.string().max(128).optional()
|
|
||||||
});
|
|
||||||
export type ChangePassword = zod.infer<typeof ZodChangePassword>;
|
|
||||||
export function isChangePassword(data: any): data is ChangePassword {
|
|
||||||
try {
|
|
||||||
ZodChangePassword.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodUser = ZodGenericDataSoftDelete.extend({
|
|
||||||
login: zod.string().max(128).optional(),
|
|
||||||
lastConnection: ZodTimestamp.optional(),
|
|
||||||
admin: zod.boolean(),
|
|
||||||
blocked: zod.boolean(),
|
|
||||||
removed: zod.boolean(),
|
|
||||||
covers: zod.array(ZodLong).optional()
|
|
||||||
});
|
|
||||||
export type User = zod.infer<typeof ZodUser>;
|
|
||||||
export function isUser(data: any): data is User {
|
|
||||||
try {
|
|
||||||
ZodUser.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodUserAuthGet = ZodUser.extend({
|
|
||||||
email: zod.string().max(512).optional(),
|
|
||||||
avatar: zod.boolean().optional()
|
|
||||||
});
|
|
||||||
export type UserAuthGet = zod.infer<typeof ZodUserAuthGet>;
|
|
||||||
export function isUserAuthGet(data: any): data is UserAuthGet {
|
|
||||||
try {
|
|
||||||
ZodUserAuthGet.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodUserCreate = zod.object({
|
|
||||||
login: zod.string().max(255).optional(),
|
|
||||||
email: zod.string().max(255).optional(),
|
|
||||||
password: zod.string().max(255).optional()
|
|
||||||
});
|
|
||||||
export type UserCreate = zod.infer<typeof ZodUserCreate>;
|
|
||||||
export function isUserCreate(data: any): data is UserCreate {
|
|
||||||
try {
|
|
||||||
ZodUserCreate.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodUserOut = zod.object({
|
|
||||||
id: ZodLong,
|
|
||||||
login: zod.string().max(255).optional()
|
|
||||||
});
|
|
||||||
export type UserOut = zod.infer<typeof ZodUserOut>;
|
|
||||||
export function isUserOut(data: any): data is UserOut {
|
|
||||||
try {
|
|
||||||
ZodUserOut.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodGetToken = zod.object({
|
|
||||||
jwt: zod.string().optional()
|
|
||||||
});
|
|
||||||
export type GetToken = zod.infer<typeof ZodGetToken>;
|
|
||||||
export function isGetToken(data: any): data is GetToken {
|
|
||||||
try {
|
|
||||||
ZodGetToken.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodDataGetToken = zod.object({
|
|
||||||
});
|
|
||||||
export type DataGetToken = zod.infer<typeof ZodDataGetToken>;
|
|
||||||
export function isDataGetToken(data: any): data is DataGetToken {
|
|
||||||
try {
|
|
||||||
ZodDataGetToken.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodUserAuth = ZodUser.extend({
|
|
||||||
password: zod.string().max(128).optional(),
|
|
||||||
email: zod.string().max(512).optional(),
|
|
||||||
emailValidate: ZodTimestamp.optional(),
|
|
||||||
newEmail: zod.string().max(512).optional(),
|
|
||||||
avatar: zod.boolean().optional(),
|
|
||||||
// List of accessible application (if not set the application is not available)
|
|
||||||
applications: zod.array(ZodLong).optional()
|
|
||||||
});
|
|
||||||
export type UserAuth = zod.infer<typeof ZodUserAuth>;
|
|
||||||
export function isUserAuth(data: any): data is UserAuth {
|
|
||||||
try {
|
|
||||||
ZodUserAuth.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodGetSignUpAvailable = zod.object({
|
|
||||||
signup: zod.boolean()
|
|
||||||
});
|
|
||||||
export type GetSignUpAvailable = zod.infer<typeof ZodGetSignUpAvailable>;
|
|
||||||
export function isGetSignUpAvailable(data: any): data is GetSignUpAvailable {
|
|
||||||
try {
|
|
||||||
ZodGetSignUpAvailable.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const ZodSettings = ZodGenericDataSoftDelete.extend({
|
|
||||||
key: zod.string().max(512).optional(),
|
|
||||||
// Right for the specific element(ADMIN [rw] USER [rw] other [rw])
|
|
||||||
right: zod.string().max(6).optional(),
|
|
||||||
// Type Of the data
|
|
||||||
type: zod.string().max(10).optional(),
|
|
||||||
// Value of the configuration
|
|
||||||
value: zod.string().max(255).optional()
|
|
||||||
});
|
|
||||||
export type Settings = zod.infer<typeof ZodSettings>;
|
|
||||||
export function isSettings(data: any): data is Settings {
|
|
||||||
try {
|
|
||||||
ZodSettings.parse(data);
|
|
||||||
return true;
|
|
||||||
} catch (e: any) {
|
|
||||||
console.log(`Fail to parse data ${e}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
37
front/src/back-api/model/add-user-data.ts
Normal file
37
front/src/back-api/model/add-user-data.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
|
||||||
|
export const ZodAddUserData = zod.object({
|
||||||
|
userId: ZodLong.optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type AddUserData = zod.infer<typeof ZodAddUserData>;
|
||||||
|
|
||||||
|
export function isAddUserData(data: any): data is AddUserData {
|
||||||
|
try {
|
||||||
|
ZodAddUserData.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodAddUserData' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodAddUserDataWrite = ZodAddUserData.partial();
|
||||||
|
|
||||||
|
export type AddUserDataWrite = zod.infer<typeof ZodAddUserDataWrite>;
|
||||||
|
|
||||||
|
export function isAddUserDataWrite(data: any): data is AddUserDataWrite {
|
||||||
|
try {
|
||||||
|
ZodAddUserDataWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodAddUserDataWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
40
front/src/back-api/model/application-small.ts
Normal file
40
front/src/back-api/model/application-small.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
|
||||||
|
export const ZodApplicationSmall = zod.object({
|
||||||
|
id: ZodLong.optional(),
|
||||||
|
name: zod.string().max(255).optional(),
|
||||||
|
description: zod.string().max(255).optional(),
|
||||||
|
redirect: zod.string().max(255).optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type ApplicationSmall = zod.infer<typeof ZodApplicationSmall>;
|
||||||
|
|
||||||
|
export function isApplicationSmall(data: any): data is ApplicationSmall {
|
||||||
|
try {
|
||||||
|
ZodApplicationSmall.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodApplicationSmall' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodApplicationSmallWrite = ZodApplicationSmall.partial();
|
||||||
|
|
||||||
|
export type ApplicationSmallWrite = zod.infer<typeof ZodApplicationSmallWrite>;
|
||||||
|
|
||||||
|
export function isApplicationSmallWrite(data: any): data is ApplicationSmallWrite {
|
||||||
|
try {
|
||||||
|
ZodApplicationSmallWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodApplicationSmallWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
42
front/src/back-api/model/application-token.ts
Normal file
42
front/src/back-api/model/application-token.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodGenericToken} from "./generic-token";
|
||||||
|
|
||||||
|
export const ZodApplicationToken = ZodGenericToken.extend({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type ApplicationToken = zod.infer<typeof ZodApplicationToken>;
|
||||||
|
|
||||||
|
export function isApplicationToken(data: any): data is ApplicationToken {
|
||||||
|
try {
|
||||||
|
ZodApplicationToken.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodApplicationToken' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodApplicationTokenWrite = ZodApplicationToken.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type ApplicationTokenWrite = zod.infer<typeof ZodApplicationTokenWrite>;
|
||||||
|
|
||||||
|
export function isApplicationTokenWrite(data: any): data is ApplicationTokenWrite {
|
||||||
|
try {
|
||||||
|
ZodApplicationTokenWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodApplicationTokenWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
56
front/src/back-api/model/application.ts
Normal file
56
front/src/back-api/model/application.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodInteger} from "./integer";
|
||||||
|
import {ZodGenericDataSoftDelete} from "./generic-data-soft-delete";
|
||||||
|
|
||||||
|
export const ZodApplication = ZodGenericDataSoftDelete.extend({
|
||||||
|
name: zod.string().max(256).optional(),
|
||||||
|
description: zod.string().max(2048).optional(),
|
||||||
|
redirect: zod.string().max(2048),
|
||||||
|
redirectDev: zod.string().max(2048).optional(),
|
||||||
|
notification: zod.string().max(2048).optional(),
|
||||||
|
/**
|
||||||
|
* Expiration time
|
||||||
|
*/
|
||||||
|
ttl: ZodInteger,
|
||||||
|
/**
|
||||||
|
* Right is manage with Karso
|
||||||
|
*/
|
||||||
|
manageRight: zod.boolean(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type Application = zod.infer<typeof ZodApplication>;
|
||||||
|
|
||||||
|
export function isApplication(data: any): data is Application {
|
||||||
|
try {
|
||||||
|
ZodApplication.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodApplication' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodApplicationWrite = ZodApplication.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type ApplicationWrite = zod.infer<typeof ZodApplicationWrite>;
|
||||||
|
|
||||||
|
export function isApplicationWrite(data: any): data is ApplicationWrite {
|
||||||
|
try {
|
||||||
|
ZodApplicationWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodApplicationWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
40
front/src/back-api/model/change-password.ts
Normal file
40
front/src/back-api/model/change-password.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodChangePassword = zod.object({
|
||||||
|
method: zod.string().max(32).optional(),
|
||||||
|
login: zod.string().max(512).optional(),
|
||||||
|
time: zod.string().max(64).optional(),
|
||||||
|
password: zod.string().max(128).optional(),
|
||||||
|
newPassword: zod.string().max(128).optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type ChangePassword = zod.infer<typeof ZodChangePassword>;
|
||||||
|
|
||||||
|
export function isChangePassword(data: any): data is ChangePassword {
|
||||||
|
try {
|
||||||
|
ZodChangePassword.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodChangePassword' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodChangePasswordWrite = ZodChangePassword.partial();
|
||||||
|
|
||||||
|
export type ChangePasswordWrite = zod.infer<typeof ZodChangePasswordWrite>;
|
||||||
|
|
||||||
|
export function isChangePasswordWrite(data: any): data is ChangePasswordWrite {
|
||||||
|
try {
|
||||||
|
ZodChangePasswordWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodChangePasswordWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
37
front/src/back-api/model/client-token.ts
Normal file
37
front/src/back-api/model/client-token.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodClientToken = zod.object({
|
||||||
|
url: zod.string().max(1024).optional(),
|
||||||
|
jwt: zod.string().optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type ClientToken = zod.infer<typeof ZodClientToken>;
|
||||||
|
|
||||||
|
export function isClientToken(data: any): data is ClientToken {
|
||||||
|
try {
|
||||||
|
ZodClientToken.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodClientToken' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodClientTokenWrite = ZodClientToken.partial();
|
||||||
|
|
||||||
|
export type ClientTokenWrite = zod.infer<typeof ZodClientTokenWrite>;
|
||||||
|
|
||||||
|
export function isClientTokenWrite(data: any): data is ClientTokenWrite {
|
||||||
|
try {
|
||||||
|
ZodClientTokenWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodClientTokenWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
38
front/src/back-api/model/create-token-request.ts
Normal file
38
front/src/back-api/model/create-token-request.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodInteger} from "./integer";
|
||||||
|
|
||||||
|
export const ZodCreateTokenRequest = zod.object({
|
||||||
|
name: zod.string().max(255).optional(),
|
||||||
|
validity: ZodInteger.optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type CreateTokenRequest = zod.infer<typeof ZodCreateTokenRequest>;
|
||||||
|
|
||||||
|
export function isCreateTokenRequest(data: any): data is CreateTokenRequest {
|
||||||
|
try {
|
||||||
|
ZodCreateTokenRequest.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodCreateTokenRequest' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodCreateTokenRequestWrite = ZodCreateTokenRequest.partial();
|
||||||
|
|
||||||
|
export type CreateTokenRequestWrite = zod.infer<typeof ZodCreateTokenRequestWrite>;
|
||||||
|
|
||||||
|
export function isCreateTokenRequestWrite(data: any): data is CreateTokenRequestWrite {
|
||||||
|
try {
|
||||||
|
ZodCreateTokenRequestWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodCreateTokenRequestWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
35
front/src/back-api/model/data-get-token.ts
Normal file
35
front/src/back-api/model/data-get-token.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodDataGetToken = zod.object({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type DataGetToken = zod.infer<typeof ZodDataGetToken>;
|
||||||
|
|
||||||
|
export function isDataGetToken(data: any): data is DataGetToken {
|
||||||
|
try {
|
||||||
|
ZodDataGetToken.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodDataGetToken' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodDataGetTokenWrite = ZodDataGetToken.partial();
|
||||||
|
|
||||||
|
export type DataGetTokenWrite = zod.infer<typeof ZodDataGetTokenWrite>;
|
||||||
|
|
||||||
|
export function isDataGetTokenWrite(data: any): data is DataGetTokenWrite {
|
||||||
|
try {
|
||||||
|
ZodDataGetTokenWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodDataGetTokenWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
46
front/src/back-api/model/generic-data-soft-delete.ts
Normal file
46
front/src/back-api/model/generic-data-soft-delete.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodGenericData} from "./generic-data";
|
||||||
|
|
||||||
|
export const ZodGenericDataSoftDelete = ZodGenericData.extend({
|
||||||
|
/**
|
||||||
|
* Deleted state
|
||||||
|
*/
|
||||||
|
deleted: zod.boolean().readonly().optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type GenericDataSoftDelete = zod.infer<typeof ZodGenericDataSoftDelete>;
|
||||||
|
|
||||||
|
export function isGenericDataSoftDelete(data: any): data is GenericDataSoftDelete {
|
||||||
|
try {
|
||||||
|
ZodGenericDataSoftDelete.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericDataSoftDelete' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodGenericDataSoftDeleteWrite = ZodGenericDataSoftDelete.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type GenericDataSoftDeleteWrite = zod.infer<typeof ZodGenericDataSoftDeleteWrite>;
|
||||||
|
|
||||||
|
export function isGenericDataSoftDeleteWrite(data: any): data is GenericDataSoftDeleteWrite {
|
||||||
|
try {
|
||||||
|
ZodGenericDataSoftDeleteWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericDataSoftDeleteWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
46
front/src/back-api/model/generic-data.ts
Normal file
46
front/src/back-api/model/generic-data.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
import {ZodGenericTiming} from "./generic-timing";
|
||||||
|
|
||||||
|
export const ZodGenericData = ZodGenericTiming.extend({
|
||||||
|
/**
|
||||||
|
* Unique Id of the object
|
||||||
|
*/
|
||||||
|
id: ZodLong.readonly(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type GenericData = zod.infer<typeof ZodGenericData>;
|
||||||
|
|
||||||
|
export function isGenericData(data: any): data is GenericData {
|
||||||
|
try {
|
||||||
|
ZodGenericData.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericData' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodGenericDataWrite = ZodGenericData.omit({
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type GenericDataWrite = zod.infer<typeof ZodGenericDataWrite>;
|
||||||
|
|
||||||
|
export function isGenericDataWrite(data: any): data is GenericDataWrite {
|
||||||
|
try {
|
||||||
|
ZodGenericDataWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericDataWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
48
front/src/back-api/model/generic-timing.ts
Normal file
48
front/src/back-api/model/generic-timing.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodIsoDate} from "./iso-date";
|
||||||
|
|
||||||
|
export const ZodGenericTiming = zod.object({
|
||||||
|
/**
|
||||||
|
* Create time of the object
|
||||||
|
*/
|
||||||
|
createdAt: ZodIsoDate.readonly().optional(),
|
||||||
|
/**
|
||||||
|
* When update the object
|
||||||
|
*/
|
||||||
|
updatedAt: ZodIsoDate.readonly().optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type GenericTiming = zod.infer<typeof ZodGenericTiming>;
|
||||||
|
|
||||||
|
export function isGenericTiming(data: any): data is GenericTiming {
|
||||||
|
try {
|
||||||
|
ZodGenericTiming.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericTiming' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodGenericTimingWrite = ZodGenericTiming.omit({
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type GenericTimingWrite = zod.infer<typeof ZodGenericTimingWrite>;
|
||||||
|
|
||||||
|
export function isGenericTimingWrite(data: any): data is GenericTimingWrite {
|
||||||
|
try {
|
||||||
|
ZodGenericTimingWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericTimingWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
48
front/src/back-api/model/generic-token.ts
Normal file
48
front/src/back-api/model/generic-token.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
import {ZodTimestamp} from "./timestamp";
|
||||||
|
import {ZodGenericDataSoftDelete} from "./generic-data-soft-delete";
|
||||||
|
|
||||||
|
export const ZodGenericToken = ZodGenericDataSoftDelete.extend({
|
||||||
|
parentId: ZodLong,
|
||||||
|
name: zod.string(),
|
||||||
|
endValidityTime: ZodTimestamp,
|
||||||
|
token: zod.string(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type GenericToken = zod.infer<typeof ZodGenericToken>;
|
||||||
|
|
||||||
|
export function isGenericToken(data: any): data is GenericToken {
|
||||||
|
try {
|
||||||
|
ZodGenericToken.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericToken' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodGenericTokenWrite = ZodGenericToken.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type GenericTokenWrite = zod.infer<typeof ZodGenericTokenWrite>;
|
||||||
|
|
||||||
|
export function isGenericTokenWrite(data: any): data is GenericTokenWrite {
|
||||||
|
try {
|
||||||
|
ZodGenericTokenWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGenericTokenWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
36
front/src/back-api/model/get-sign-up-available.ts
Normal file
36
front/src/back-api/model/get-sign-up-available.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodGetSignUpAvailable = zod.object({
|
||||||
|
signup: zod.boolean(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type GetSignUpAvailable = zod.infer<typeof ZodGetSignUpAvailable>;
|
||||||
|
|
||||||
|
export function isGetSignUpAvailable(data: any): data is GetSignUpAvailable {
|
||||||
|
try {
|
||||||
|
ZodGetSignUpAvailable.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetSignUpAvailable' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodGetSignUpAvailableWrite = ZodGetSignUpAvailable.partial();
|
||||||
|
|
||||||
|
export type GetSignUpAvailableWrite = zod.infer<typeof ZodGetSignUpAvailableWrite>;
|
||||||
|
|
||||||
|
export function isGetSignUpAvailableWrite(data: any): data is GetSignUpAvailableWrite {
|
||||||
|
try {
|
||||||
|
ZodGetSignUpAvailableWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetSignUpAvailableWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
36
front/src/back-api/model/get-token.ts
Normal file
36
front/src/back-api/model/get-token.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodGetToken = zod.object({
|
||||||
|
jwt: zod.string(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type GetToken = zod.infer<typeof ZodGetToken>;
|
||||||
|
|
||||||
|
export function isGetToken(data: any): data is GetToken {
|
||||||
|
try {
|
||||||
|
ZodGetToken.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetToken' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodGetTokenWrite = ZodGetToken.partial();
|
||||||
|
|
||||||
|
export type GetTokenWrite = zod.infer<typeof ZodGetTokenWrite>;
|
||||||
|
|
||||||
|
export function isGetTokenWrite(data: any): data is GetTokenWrite {
|
||||||
|
try {
|
||||||
|
ZodGetTokenWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodGetTokenWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
32
front/src/back-api/model/index.ts
Normal file
32
front/src/back-api/model/index.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
export * from "./add-user-data"
|
||||||
|
export * from "./application"
|
||||||
|
export * from "./application-small"
|
||||||
|
export * from "./application-token"
|
||||||
|
export * from "./change-password"
|
||||||
|
export * from "./client-token"
|
||||||
|
export * from "./create-token-request"
|
||||||
|
export * from "./data-get-token"
|
||||||
|
export * from "./generic-data"
|
||||||
|
export * from "./generic-data-soft-delete"
|
||||||
|
export * from "./generic-timing"
|
||||||
|
export * from "./generic-token"
|
||||||
|
export * from "./get-sign-up-available"
|
||||||
|
export * from "./get-token"
|
||||||
|
export * from "./int"
|
||||||
|
export * from "./integer"
|
||||||
|
export * from "./iso-date"
|
||||||
|
export * from "./long"
|
||||||
|
export * from "./public-key"
|
||||||
|
export * from "./rest-error-response"
|
||||||
|
export * from "./right"
|
||||||
|
export * from "./right-description"
|
||||||
|
export * from "./timestamp"
|
||||||
|
export * from "./user"
|
||||||
|
export * from "./user-auth"
|
||||||
|
export * from "./user-auth-get"
|
||||||
|
export * from "./user-create"
|
||||||
|
export * from "./user-out"
|
||||||
|
export * from "./uuid"
|
35
front/src/back-api/model/int.ts
Normal file
35
front/src/back-api/model/int.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const Zodint = zod.object({
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type int = zod.infer<typeof Zodint>;
|
||||||
|
|
||||||
|
export function isint(data: any): data is int {
|
||||||
|
try {
|
||||||
|
Zodint.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='Zodint' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodintWrite = Zodint.partial();
|
||||||
|
|
||||||
|
export type intWrite = zod.infer<typeof ZodintWrite>;
|
||||||
|
|
||||||
|
export function isintWrite(data: any): data is intWrite {
|
||||||
|
try {
|
||||||
|
ZodintWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodintWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
8
front/src/back-api/model/integer.ts
Normal file
8
front/src/back-api/model/integer.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodInteger = zod.number().safe();
|
||||||
|
export type Integer = zod.infer<typeof ZodInteger>;
|
8
front/src/back-api/model/iso-date.ts
Normal file
8
front/src/back-api/model/iso-date.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodIsoDate = zod.string().datetime({ precision: 3 });
|
||||||
|
export type IsoDate = zod.infer<typeof ZodIsoDate>;
|
8
front/src/back-api/model/long.ts
Normal file
8
front/src/back-api/model/long.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodLong = zod.number();
|
||||||
|
export type Long = zod.infer<typeof ZodLong>;
|
36
front/src/back-api/model/public-key.ts
Normal file
36
front/src/back-api/model/public-key.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodPublicKey = zod.object({
|
||||||
|
key: zod.string().max(255).optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type PublicKey = zod.infer<typeof ZodPublicKey>;
|
||||||
|
|
||||||
|
export function isPublicKey(data: any): data is PublicKey {
|
||||||
|
try {
|
||||||
|
ZodPublicKey.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodPublicKey' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodPublicKeyWrite = ZodPublicKey.partial();
|
||||||
|
|
||||||
|
export type PublicKeyWrite = zod.infer<typeof ZodPublicKeyWrite>;
|
||||||
|
|
||||||
|
export function isPublicKeyWrite(data: any): data is PublicKeyWrite {
|
||||||
|
try {
|
||||||
|
ZodPublicKeyWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodPublicKeyWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
43
front/src/back-api/model/rest-error-response.ts
Normal file
43
front/src/back-api/model/rest-error-response.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodUUID} from "./uuid";
|
||||||
|
import {Zodint} from "./int";
|
||||||
|
|
||||||
|
export const ZodRestErrorResponse = zod.object({
|
||||||
|
uuid: ZodUUID.optional(),
|
||||||
|
name: zod.string(),
|
||||||
|
message: zod.string(),
|
||||||
|
time: zod.string(),
|
||||||
|
status: Zodint,
|
||||||
|
statusMessage: zod.string(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type RestErrorResponse = zod.infer<typeof ZodRestErrorResponse>;
|
||||||
|
|
||||||
|
export function isRestErrorResponse(data: any): data is RestErrorResponse {
|
||||||
|
try {
|
||||||
|
ZodRestErrorResponse.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodRestErrorResponse' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodRestErrorResponseWrite = ZodRestErrorResponse.partial();
|
||||||
|
|
||||||
|
export type RestErrorResponseWrite = zod.infer<typeof ZodRestErrorResponseWrite>;
|
||||||
|
|
||||||
|
export function isRestErrorResponseWrite(data: any): data is RestErrorResponseWrite {
|
||||||
|
try {
|
||||||
|
ZodRestErrorResponseWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodRestErrorResponseWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
67
front/src/back-api/model/right-description.ts
Normal file
67
front/src/back-api/model/right-description.ts
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
import {ZodGenericDataSoftDelete} from "./generic-data-soft-delete";
|
||||||
|
|
||||||
|
export const ZodRightDescription = ZodGenericDataSoftDelete.extend({
|
||||||
|
/**
|
||||||
|
* Application id that have the reference of the right
|
||||||
|
*/
|
||||||
|
applicationId: ZodLong,
|
||||||
|
/**
|
||||||
|
* Key of the property
|
||||||
|
*/
|
||||||
|
key: zod.string().max(64),
|
||||||
|
/**
|
||||||
|
* Title of the right
|
||||||
|
*/
|
||||||
|
title: zod.string().max(1024),
|
||||||
|
/**
|
||||||
|
* Description of the right
|
||||||
|
*/
|
||||||
|
description: zod.string().max(1024),
|
||||||
|
/**
|
||||||
|
* default value if Never set
|
||||||
|
*/
|
||||||
|
defaultValue: zod.string().max(1024).optional(),
|
||||||
|
/**
|
||||||
|
* Type of the property
|
||||||
|
*/
|
||||||
|
type: zod.string().max(16),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type RightDescription = zod.infer<typeof ZodRightDescription>;
|
||||||
|
|
||||||
|
export function isRightDescription(data: any): data is RightDescription {
|
||||||
|
try {
|
||||||
|
ZodRightDescription.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodRightDescription' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodRightDescriptionWrite = ZodRightDescription.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type RightDescriptionWrite = zod.infer<typeof ZodRightDescriptionWrite>;
|
||||||
|
|
||||||
|
export function isRightDescriptionWrite(data: any): data is RightDescriptionWrite {
|
||||||
|
try {
|
||||||
|
ZodRightDescriptionWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodRightDescriptionWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
59
front/src/back-api/model/right.ts
Normal file
59
front/src/back-api/model/right.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
import {ZodGenericDataSoftDelete} from "./generic-data-soft-delete";
|
||||||
|
|
||||||
|
export const ZodRight = ZodGenericDataSoftDelete.extend({
|
||||||
|
/**
|
||||||
|
* application-ID that have the reference of the right
|
||||||
|
*/
|
||||||
|
applicationId: ZodLong,
|
||||||
|
/**
|
||||||
|
* user-ID
|
||||||
|
*/
|
||||||
|
userId: ZodLong,
|
||||||
|
/**
|
||||||
|
* rightDescription-ID of the right description
|
||||||
|
*/
|
||||||
|
rightDescriptionId: ZodLong,
|
||||||
|
/**
|
||||||
|
* Value of the right
|
||||||
|
*/
|
||||||
|
value: zod.string().max(1024),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type Right = zod.infer<typeof ZodRight>;
|
||||||
|
|
||||||
|
export function isRight(data: any): data is Right {
|
||||||
|
try {
|
||||||
|
ZodRight.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodRight' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodRightWrite = ZodRight.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type RightWrite = zod.infer<typeof ZodRightWrite>;
|
||||||
|
|
||||||
|
export function isRightWrite(data: any): data is RightWrite {
|
||||||
|
try {
|
||||||
|
ZodRightWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodRightWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
8
front/src/back-api/model/timestamp.ts
Normal file
8
front/src/back-api/model/timestamp.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodTimestamp = zod.string().datetime({ precision: 3 });
|
||||||
|
export type Timestamp = zod.infer<typeof ZodTimestamp>;
|
44
front/src/back-api/model/user-auth-get.ts
Normal file
44
front/src/back-api/model/user-auth-get.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodUser} from "./user";
|
||||||
|
|
||||||
|
export const ZodUserAuthGet = ZodUser.extend({
|
||||||
|
email: zod.string().max(512),
|
||||||
|
avatar: zod.boolean(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type UserAuthGet = zod.infer<typeof ZodUserAuthGet>;
|
||||||
|
|
||||||
|
export function isUserAuthGet(data: any): data is UserAuthGet {
|
||||||
|
try {
|
||||||
|
ZodUserAuthGet.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserAuthGet' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodUserAuthGetWrite = ZodUserAuthGet.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type UserAuthGetWrite = zod.infer<typeof ZodUserAuthGetWrite>;
|
||||||
|
|
||||||
|
export function isUserAuthGetWrite(data: any): data is UserAuthGetWrite {
|
||||||
|
try {
|
||||||
|
ZodUserAuthGetWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserAuthGetWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
53
front/src/back-api/model/user-auth.ts
Normal file
53
front/src/back-api/model/user-auth.ts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodTimestamp} from "./timestamp";
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
import {ZodUser} from "./user";
|
||||||
|
|
||||||
|
export const ZodUserAuth = ZodUser.extend({
|
||||||
|
password: zod.string().max(128),
|
||||||
|
email: zod.string().max(512),
|
||||||
|
emailValidate: ZodTimestamp.optional(),
|
||||||
|
newEmail: zod.string().max(512).optional(),
|
||||||
|
avatar: zod.boolean(),
|
||||||
|
/**
|
||||||
|
* List of accessible application (if not set the application is not available)
|
||||||
|
*/
|
||||||
|
applications: zod.array(ZodLong),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type UserAuth = zod.infer<typeof ZodUserAuth>;
|
||||||
|
|
||||||
|
export function isUserAuth(data: any): data is UserAuth {
|
||||||
|
try {
|
||||||
|
ZodUserAuth.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserAuth' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodUserAuthWrite = ZodUserAuth.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type UserAuthWrite = zod.infer<typeof ZodUserAuthWrite>;
|
||||||
|
|
||||||
|
export function isUserAuthWrite(data: any): data is UserAuthWrite {
|
||||||
|
try {
|
||||||
|
ZodUserAuthWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserAuthWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
38
front/src/back-api/model/user-create.ts
Normal file
38
front/src/back-api/model/user-create.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodUserCreate = zod.object({
|
||||||
|
login: zod.string().max(255).optional(),
|
||||||
|
email: zod.string().max(255).optional(),
|
||||||
|
password: zod.string().max(255).optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type UserCreate = zod.infer<typeof ZodUserCreate>;
|
||||||
|
|
||||||
|
export function isUserCreate(data: any): data is UserCreate {
|
||||||
|
try {
|
||||||
|
ZodUserCreate.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserCreate' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodUserCreateWrite = ZodUserCreate.partial();
|
||||||
|
|
||||||
|
export type UserCreateWrite = zod.infer<typeof ZodUserCreateWrite>;
|
||||||
|
|
||||||
|
export function isUserCreateWrite(data: any): data is UserCreateWrite {
|
||||||
|
try {
|
||||||
|
ZodUserCreateWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserCreateWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
38
front/src/back-api/model/user-out.ts
Normal file
38
front/src/back-api/model/user-out.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodLong} from "./long";
|
||||||
|
|
||||||
|
export const ZodUserOut = zod.object({
|
||||||
|
id: ZodLong,
|
||||||
|
login: zod.string().max(255).optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type UserOut = zod.infer<typeof ZodUserOut>;
|
||||||
|
|
||||||
|
export function isUserOut(data: any): data is UserOut {
|
||||||
|
try {
|
||||||
|
ZodUserOut.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserOut' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodUserOutWrite = ZodUserOut.partial();
|
||||||
|
|
||||||
|
export type UserOutWrite = zod.infer<typeof ZodUserOutWrite>;
|
||||||
|
|
||||||
|
export function isUserOutWrite(data: any): data is UserOutWrite {
|
||||||
|
try {
|
||||||
|
ZodUserOutWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserOutWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
53
front/src/back-api/model/user.ts
Normal file
53
front/src/back-api/model/user.ts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
import {ZodTimestamp} from "./timestamp";
|
||||||
|
import {ZodUUID} from "./uuid";
|
||||||
|
import {ZodGenericDataSoftDelete} from "./generic-data-soft-delete";
|
||||||
|
|
||||||
|
export const ZodUser = ZodGenericDataSoftDelete.extend({
|
||||||
|
login: zod.string().max(128).optional(),
|
||||||
|
lastConnection: ZodTimestamp.optional(),
|
||||||
|
admin: zod.boolean(),
|
||||||
|
blocked: zod.boolean(),
|
||||||
|
removed: zod.boolean(),
|
||||||
|
/**
|
||||||
|
* List of Id of the specific covers
|
||||||
|
*/
|
||||||
|
covers: zod.array(ZodUUID).optional(),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
export type User = zod.infer<typeof ZodUser>;
|
||||||
|
|
||||||
|
export function isUser(data: any): data is User {
|
||||||
|
try {
|
||||||
|
ZodUser.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUser' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ZodUserWrite = ZodUser.omit({
|
||||||
|
deleted: true,
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
|
||||||
|
}).partial();
|
||||||
|
|
||||||
|
export type UserWrite = zod.infer<typeof ZodUserWrite>;
|
||||||
|
|
||||||
|
export function isUserWrite(data: any): data is UserWrite {
|
||||||
|
try {
|
||||||
|
ZodUserWrite.parse(data);
|
||||||
|
return true;
|
||||||
|
} catch (e: any) {
|
||||||
|
console.log(`Fail to parse data type='ZodUserWrite' error=${e}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
8
front/src/back-api/model/uuid.ts
Normal file
8
front/src/back-api/model/uuid.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Interface of the server (auto-generated code)
|
||||||
|
*/
|
||||||
|
import { z as zod } from "zod";
|
||||||
|
|
||||||
|
|
||||||
|
export const ZodUUID = zod.string().uuid();
|
||||||
|
export type UUID = zod.infer<typeof ZodUUID>;
|
@ -4,25 +4,25 @@
|
|||||||
* @license MPL-2
|
* @license MPL-2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { RestErrorResponse } from "./model"
|
import { RestErrorResponse } from "./model";
|
||||||
|
|
||||||
export enum HTTPRequestModel {
|
export enum HTTPRequestModel {
|
||||||
DELETE = 'DELETE',
|
DELETE = "DELETE",
|
||||||
GET = 'GET',
|
GET = "GET",
|
||||||
PATCH = 'PATCH',
|
PATCH = "PATCH",
|
||||||
POST = 'POST',
|
POST = "POST",
|
||||||
PUT = 'PUT',
|
PUT = "PUT",
|
||||||
}
|
}
|
||||||
export enum HTTPMimeType {
|
export enum HTTPMimeType {
|
||||||
ALL = '*/*',
|
ALL = "*/*",
|
||||||
CSV = 'text/csv',
|
CSV = "text/csv",
|
||||||
IMAGE = 'image/*',
|
IMAGE = "image/*",
|
||||||
IMAGE_JPEG = 'image/jpeg',
|
IMAGE_JPEG = "image/jpeg",
|
||||||
IMAGE_PNG = 'image/png',
|
IMAGE_PNG = "image/png",
|
||||||
JSON = 'application/json',
|
JSON = "application/json",
|
||||||
MULTIPART = 'multipart/form-data',
|
MULTIPART = "multipart/form-data",
|
||||||
OCTET_STREAM = 'application/octet-stream',
|
OCTET_STREAM = "application/octet-stream",
|
||||||
TEXT_PLAIN = 'text/plain',
|
TEXT_PLAIN = "text/plain",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RESTConfig {
|
export interface RESTConfig {
|
||||||
@ -50,23 +50,6 @@ export interface ModelResponseHttp {
|
|||||||
data: any;
|
data: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isArrayOf<TYPE>(
|
|
||||||
data: any,
|
|
||||||
typeChecker: (subData: any) => subData is TYPE,
|
|
||||||
length?: number
|
|
||||||
): data is TYPE[] {
|
|
||||||
if (!Array.isArray(data)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!data.every(typeChecker)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (length !== undefined && data.length != length) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isNullOrUndefined(data: any): data is undefined | null {
|
function isNullOrUndefined(data: any): data is undefined | null {
|
||||||
return data === undefined || data === null;
|
return data === undefined || data === null;
|
||||||
}
|
}
|
||||||
@ -75,52 +58,61 @@ function isNullOrUndefined(data: any): data is undefined | null {
|
|||||||
export type ProgressCallback = (count: number, total: number) => void;
|
export type ProgressCallback = (count: number, total: number) => void;
|
||||||
|
|
||||||
export interface RESTAbort {
|
export interface RESTAbort {
|
||||||
abort?: () => boolean
|
abort?: () => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Rest generic callback have a basic model to upload and download advancement.
|
// Rest generic callback have a basic model to upload and download advancement.
|
||||||
export interface RESTCallbacks {
|
export interface RESTCallbacks {
|
||||||
progressUpload?: ProgressCallback,
|
progressUpload?: ProgressCallback;
|
||||||
progressDownload?: ProgressCallback,
|
progressDownload?: ProgressCallback;
|
||||||
abortHandle?: RESTAbort,
|
abortHandle?: RESTAbort;
|
||||||
};
|
}
|
||||||
|
|
||||||
export interface RESTRequestType {
|
export interface RESTRequestType {
|
||||||
restModel: RESTModel,
|
restModel: RESTModel;
|
||||||
restConfig: RESTConfig,
|
restConfig: RESTConfig;
|
||||||
data?: any,
|
data?: any;
|
||||||
params?: object,
|
params?: object;
|
||||||
queries?: object,
|
queries?: object;
|
||||||
callback?: RESTCallbacks,
|
callback?: RESTCallbacks;
|
||||||
};
|
}
|
||||||
|
|
||||||
function replaceAll(input, searchValue, replaceValue) {
|
function replaceAll(input, searchValue, replaceValue) {
|
||||||
return input.split(searchValue).join(replaceValue);
|
return input.split(searchValue).join(replaceValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeTrailingSlashes(input: string): string {
|
function removeTrailingSlashes(input: string): string {
|
||||||
if (isNullOrUndefined(input)) {
|
if (isNullOrUndefined(input)) {
|
||||||
return "undefined";
|
return "undefined";
|
||||||
}
|
}
|
||||||
return input.replace(/\/+$/, '');
|
return input.replace(/\/+$/, "");
|
||||||
}
|
}
|
||||||
function removeLeadingSlashes(input: string): string {
|
function removeLeadingSlashes(input: string): string {
|
||||||
if (isNullOrUndefined(input)) {
|
if (isNullOrUndefined(input)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return input.replace(/^\/+/, '');
|
return input.replace(/^\/+/, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RESTUrl({ restModel, restConfig, params, queries }: RESTRequestType): string {
|
export function RESTUrl({
|
||||||
|
restModel,
|
||||||
|
restConfig,
|
||||||
|
params,
|
||||||
|
queries,
|
||||||
|
}: RESTRequestType): string {
|
||||||
// Create the URL PATH:
|
// Create the URL PATH:
|
||||||
let generateUrl = `${removeTrailingSlashes(restConfig.server)}/${removeLeadingSlashes(restModel.endPoint)}`;
|
let generateUrl = `${removeTrailingSlashes(
|
||||||
|
restConfig.server
|
||||||
|
)}/${removeLeadingSlashes(restModel.endPoint)}`;
|
||||||
if (params !== undefined) {
|
if (params !== undefined) {
|
||||||
for (let key of Object.keys(params)) {
|
for (let key of Object.keys(params)) {
|
||||||
generateUrl = replaceAll(generateUrl, `{${key}}`, `${params[key]}`);
|
generateUrl = replaceAll(generateUrl, `{${key}}`, `${params[key]}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (queries === undefined && (restConfig.token === undefined || restModel.tokenInUrl !== true)) {
|
if (
|
||||||
|
queries === undefined &&
|
||||||
|
(restConfig.token === undefined || restModel.tokenInUrl !== true)
|
||||||
|
) {
|
||||||
return generateUrl;
|
return generateUrl;
|
||||||
}
|
}
|
||||||
const searchParams = new URLSearchParams();
|
const searchParams = new URLSearchParams();
|
||||||
@ -128,8 +120,8 @@ export function RESTUrl({ restModel, restConfig, params, queries }: RESTRequestT
|
|||||||
for (let key of Object.keys(queries)) {
|
for (let key of Object.keys(queries)) {
|
||||||
const value = queries[key];
|
const value = queries[key];
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
for (let iii = 0; iii < value.length; iii++) {
|
for (const element of value) {
|
||||||
searchParams.append(`${key}`, `${value[iii]}`);
|
searchParams.append(`${key}`, `${element}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
searchParams.append(`${key}`, `${value}`);
|
searchParams.append(`${key}`, `${value}`);
|
||||||
@ -137,36 +129,43 @@ export function RESTUrl({ restModel, restConfig, params, queries }: RESTRequestT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (restConfig.token !== undefined && restModel.tokenInUrl === true) {
|
if (restConfig.token !== undefined && restModel.tokenInUrl === true) {
|
||||||
searchParams.append('Authorization', `Bearer ${restConfig.token}`);
|
searchParams.append("Authorization", `Bearer ${restConfig.token}`);
|
||||||
}
|
}
|
||||||
return generateUrl + "?" + searchParams.toString();
|
return generateUrl + "?" + searchParams.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fetchProgress(
|
||||||
export function fetchProgress(generateUrl: string, { method, headers, body }: {
|
generateUrl: string,
|
||||||
method: HTTPRequestModel,
|
{
|
||||||
headers: any,
|
method,
|
||||||
body: any,
|
headers,
|
||||||
}, { progressUpload, progressDownload, abortHandle }: RESTCallbacks): Promise<Response> {
|
body,
|
||||||
const xhr = {
|
}: {
|
||||||
io: new XMLHttpRequest()
|
method: HTTPRequestModel;
|
||||||
}
|
headers: any;
|
||||||
|
body: any;
|
||||||
|
},
|
||||||
|
{ progressUpload, progressDownload, abortHandle }: RESTCallbacks
|
||||||
|
): Promise<Response> {
|
||||||
|
const xhr: {
|
||||||
|
io?: XMLHttpRequest;
|
||||||
|
} = {
|
||||||
|
io: new XMLHttpRequest(),
|
||||||
|
};
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// Stream the upload progress
|
// Stream the upload progress
|
||||||
if (progressUpload) {
|
if (progressUpload) {
|
||||||
xhr.io.upload.addEventListener("progress", (dataEvent) => {
|
xhr.io?.upload.addEventListener("progress", (dataEvent) => {
|
||||||
if (dataEvent.lengthComputable) {
|
if (dataEvent.lengthComputable) {
|
||||||
//console.log(` ==> has a progress event: ${dataEvent.loaded} / ${dataEvent.total}`);
|
|
||||||
progressUpload(dataEvent.loaded, dataEvent.total);
|
progressUpload(dataEvent.loaded, dataEvent.total);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Stream the download progress
|
// Stream the download progress
|
||||||
if (progressDownload) {
|
if (progressDownload) {
|
||||||
xhr.io.addEventListener("progress", (dataEvent) => {
|
xhr.io?.addEventListener("progress", (dataEvent) => {
|
||||||
if (dataEvent.lengthComputable) {
|
if (dataEvent.lengthComputable) {
|
||||||
//console.log(` ==> download progress:: ${dataEvent.loaded} / ${dataEvent.total}`);
|
progressDownload(dataEvent.loaded, dataEvent.total);
|
||||||
progressUpload(dataEvent.loaded, dataEvent.total);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -177,38 +176,43 @@ export function fetchProgress(generateUrl: string, { method, headers, body }: {
|
|||||||
xhr.io.abort();
|
xhr.io.abort();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
console.log(`Request abort (FAIL) on the XMLHttpRequest: ${generateUrl}`);
|
console.log(
|
||||||
|
`Request abort (FAIL) on the XMLHttpRequest: ${generateUrl}`
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
// Check if we have an internal Fail:
|
// Check if we have an internal Fail:
|
||||||
xhr.io.addEventListener('error', () => {
|
xhr.io?.addEventListener("error", () => {
|
||||||
xhr.io = undefined;
|
xhr.io = undefined;
|
||||||
reject(new TypeError('Failed to fetch'))
|
reject(new TypeError("Failed to fetch"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Capture the end of the stream
|
// Capture the end of the stream
|
||||||
xhr.io.addEventListener("loadend", () => {
|
xhr.io?.addEventListener("loadend", () => {
|
||||||
if (xhr.io.readyState !== XMLHttpRequest.DONE) {
|
if (xhr.io?.readyState !== XMLHttpRequest.DONE) {
|
||||||
//console.log(` ==> READY state`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (xhr.io.status === 0) {
|
if (xhr.io?.status === 0) {
|
||||||
//the stream has been aborted
|
//the stream has been aborted
|
||||||
reject(new TypeError('Fetch has been aborted'));
|
reject(new TypeError("Fetch has been aborted"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Stream is ended, transform in a generic response:
|
// Stream is ended, transform in a generic response:
|
||||||
const response = new Response(xhr.io.response, {
|
const response = new Response(xhr.io.response, {
|
||||||
status: xhr.io.status,
|
status: xhr.io.status,
|
||||||
statusText: xhr.io.statusText
|
statusText: xhr.io.statusText,
|
||||||
});
|
});
|
||||||
const headersArray = replaceAll(xhr.io.getAllResponseHeaders().trim(), "\r\n", "\n").split('\n');
|
const headersArray = replaceAll(
|
||||||
|
xhr.io.getAllResponseHeaders().trim(),
|
||||||
|
"\r\n",
|
||||||
|
"\n"
|
||||||
|
).split("\n");
|
||||||
headersArray.forEach(function (header) {
|
headersArray.forEach(function (header) {
|
||||||
const firstColonIndex = header.indexOf(':');
|
const firstColonIndex = header.indexOf(":");
|
||||||
if (firstColonIndex !== -1) {
|
if (firstColonIndex !== -1) {
|
||||||
var key = header.substring(0, firstColonIndex).trim();
|
const key = header.substring(0, firstColonIndex).trim();
|
||||||
var value = header.substring(firstColonIndex + 1).trim();
|
const value = header.substring(firstColonIndex + 1).trim();
|
||||||
response.headers.set(key, value);
|
response.headers.set(key, value);
|
||||||
} else {
|
} else {
|
||||||
response.headers.set(header, "");
|
response.headers.set(header, "");
|
||||||
@ -217,31 +221,38 @@ export function fetchProgress(generateUrl: string, { method, headers, body }: {
|
|||||||
xhr.io = undefined;
|
xhr.io = undefined;
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
xhr.io.open(method, generateUrl, true);
|
xhr.io?.open(method, generateUrl, true);
|
||||||
if (!isNullOrUndefined(headers)) {
|
if (!isNullOrUndefined(headers)) {
|
||||||
for (const [key, value] of Object.entries(headers)) {
|
for (const [key, value] of Object.entries(headers)) {
|
||||||
xhr.io.setRequestHeader(key, value as string);
|
xhr.io?.setRequestHeader(key, value as string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhr.io.send(body);
|
xhr.io?.send(body);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RESTRequest({ restModel, restConfig, data, params, queries, callback }: RESTRequestType): Promise<ModelResponseHttp> {
|
export function RESTRequest({
|
||||||
|
restModel,
|
||||||
|
restConfig,
|
||||||
|
data,
|
||||||
|
params,
|
||||||
|
queries,
|
||||||
|
callback,
|
||||||
|
}: RESTRequestType): Promise<ModelResponseHttp> {
|
||||||
// Create the URL PATH:
|
// Create the URL PATH:
|
||||||
let generateUrl = RESTUrl({ restModel, restConfig, data, params, queries });
|
let generateUrl = RESTUrl({ restModel, restConfig, data, params, queries });
|
||||||
let headers: any = {};
|
let headers: any = {};
|
||||||
if (restConfig.token !== undefined && restModel.tokenInUrl !== true) {
|
if (restConfig.token !== undefined && restModel.tokenInUrl !== true) {
|
||||||
headers['Authorization'] = `Bearer ${restConfig.token}`;
|
headers["Authorization"] = `Bearer ${restConfig.token}`;
|
||||||
}
|
}
|
||||||
if (restModel.accept !== undefined) {
|
if (restModel.accept !== undefined) {
|
||||||
headers['Accept'] = restModel.accept;
|
headers["Accept"] = restModel.accept;
|
||||||
}
|
}
|
||||||
if (restModel.requestType !== HTTPRequestModel.GET) {
|
if (restModel.requestType !== HTTPRequestModel.GET) {
|
||||||
// if Get we have not a content type, the body is empty
|
// if Get we have not a content type, the body is empty
|
||||||
if (restModel.contentType !== HTTPMimeType.MULTIPART) {
|
if (restModel.contentType !== HTTPMimeType.MULTIPART) {
|
||||||
// special case of multi-part ==> no content type otherwise the browser does not set the ";bundary=--****"
|
// special case of multi-part ==> no content type otherwise the browser does not set the ";bundary=--****"
|
||||||
headers['Content-Type'] = restModel.contentType;
|
headers["Content-Type"] = restModel.contentType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let body = data;
|
let body = data;
|
||||||
@ -252,14 +263,16 @@ export function RESTRequest({ restModel, restConfig, data, params, queries, call
|
|||||||
for (const name in data) {
|
for (const name in data) {
|
||||||
formData.append(name, data[name]);
|
formData.append(name, data[name]);
|
||||||
}
|
}
|
||||||
body = formData
|
body = formData;
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let action: undefined | Promise<Response> = undefined;
|
let action: undefined | Promise<Response> = undefined;
|
||||||
if (isNullOrUndefined(callback)
|
if (
|
||||||
|| (isNullOrUndefined(callback.progressDownload)
|
isNullOrUndefined(callback) ||
|
||||||
&& isNullOrUndefined(callback.progressUpload)
|
(isNullOrUndefined(callback.progressDownload) &&
|
||||||
&& isNullOrUndefined(callback.abortHandle))) {
|
isNullOrUndefined(callback.progressUpload) &&
|
||||||
|
isNullOrUndefined(callback.abortHandle))
|
||||||
|
) {
|
||||||
// No information needed: call the generic fetch interface
|
// No information needed: call the generic fetch interface
|
||||||
action = fetch(generateUrl, {
|
action = fetch(generateUrl, {
|
||||||
method: restModel.requestType,
|
method: restModel.requestType,
|
||||||
@ -268,113 +281,112 @@ export function RESTRequest({ restModel, restConfig, data, params, queries, call
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// need progression information: call old fetch model (XMLHttpRequest) that permit to keep % upload and % download for HTTP1.x
|
// need progression information: call old fetch model (XMLHttpRequest) that permit to keep % upload and % download for HTTP1.x
|
||||||
action = fetchProgress(generateUrl, {
|
action = fetchProgress(
|
||||||
method: restModel.requestType ?? HTTPRequestModel.GET,
|
generateUrl,
|
||||||
headers,
|
{
|
||||||
body,
|
method: restModel.requestType ?? HTTPRequestModel.GET,
|
||||||
}, callback);
|
headers,
|
||||||
|
body,
|
||||||
|
},
|
||||||
|
callback
|
||||||
|
);
|
||||||
}
|
}
|
||||||
action.then((response: Response) => {
|
action
|
||||||
if (response.status >= 200 && response.status <= 299) {
|
.then((response: Response) => {
|
||||||
const contentType = response.headers.get('Content-Type');
|
if (response.status >= 200 && response.status <= 299) {
|
||||||
if (!isNullOrUndefined(restModel.accept) && restModel.accept !== contentType) {
|
const contentType = response.headers.get("Content-Type");
|
||||||
reject({
|
if (
|
||||||
time: Date().toString(),
|
!isNullOrUndefined(restModel.accept) &&
|
||||||
status: 901,
|
restModel.accept !== contentType
|
||||||
error: `REST check wrong type: ${restModel.accept} != ${contentType}`,
|
) {
|
||||||
statusMessage: "Fetch error",
|
reject({
|
||||||
message: "rest-tools.ts Wrong type in the message return type"
|
name: "Model accept type incompatible",
|
||||||
} as RestErrorResponse);
|
time: Date().toString(),
|
||||||
} else if (contentType === HTTPMimeType.JSON) {
|
status: 901,
|
||||||
response
|
error: `REST check wrong type: ${restModel.accept} != ${contentType}`,
|
||||||
.json()
|
statusMessage: "Fetch error",
|
||||||
.then((value: any) => {
|
message: "rest-tools.ts Wrong type in the message return type",
|
||||||
//console.log(`RECEIVE ==> ${response.status}=${ JSON.stringify(value, null, 2)}`);
|
} as RestErrorResponse);
|
||||||
resolve({ status: response.status, data: value });
|
} else if (contentType === HTTPMimeType.JSON) {
|
||||||
})
|
response
|
||||||
.catch((reason: any) => {
|
.json()
|
||||||
reject({
|
.then((value: any) => {
|
||||||
time: Date().toString(),
|
resolve({ status: response.status, data: value });
|
||||||
status: 902,
|
})
|
||||||
error: `REST parse json fail: ${reason}`,
|
.catch((reason: any) => {
|
||||||
statusMessage: "Fetch parse error",
|
reject({
|
||||||
message: "rest-tools.ts Wrong message model to parse"
|
name: "API serialization error",
|
||||||
} as RestErrorResponse);
|
time: Date().toString(),
|
||||||
});
|
status: 902,
|
||||||
|
error: `REST parse json fail: ${reason}`,
|
||||||
|
statusMessage: "Fetch parse error",
|
||||||
|
message: "rest-tools.ts Wrong message model to parse",
|
||||||
|
} as RestErrorResponse);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resolve({ status: response.status, data: response.body });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
resolve({ status: response.status, data: response.body });
|
reject({
|
||||||
|
name: "REST return no OK status",
|
||||||
|
time: Date().toString(),
|
||||||
|
status: response.status,
|
||||||
|
error: `${response.body}`,
|
||||||
|
statusMessage: "Fetch code error",
|
||||||
|
message: "rest-tools.ts Wrong return code",
|
||||||
|
} as RestErrorResponse);
|
||||||
}
|
}
|
||||||
} else {
|
})
|
||||||
|
.catch((error: any) => {
|
||||||
reject({
|
reject({
|
||||||
time: Date().toString(),
|
name: "Request fail",
|
||||||
status: response.status,
|
time: Date(),
|
||||||
error: `${response.body}`,
|
status: 999,
|
||||||
statusMessage: "Fetch code error",
|
error: error,
|
||||||
message: "rest-tools.ts Wrong return code"
|
statusMessage: "Fetch catch error",
|
||||||
} as RestErrorResponse);
|
message: "rest-tools.ts detect an error in the fetch request",
|
||||||
}
|
});
|
||||||
}).catch((error: any) => {
|
|
||||||
reject({
|
|
||||||
time: Date(),
|
|
||||||
status: 999,
|
|
||||||
error: error,
|
|
||||||
statusMessage: "Fetch catch error",
|
|
||||||
message: "rest-tools.ts detect an error in the fetch request"
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function RESTRequestJson<TYPE>(
|
||||||
|
request: RESTRequestType,
|
||||||
export function RESTRequestJson<TYPE>(request: RESTRequestType, checker: (data: any) => data is TYPE): Promise<TYPE> {
|
checker?: (data: any) => data is TYPE
|
||||||
|
): Promise<TYPE> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
RESTRequest(request).then((value: ModelResponseHttp) => {
|
RESTRequest(request)
|
||||||
if (isNullOrUndefined(checker)) {
|
.then((value: ModelResponseHttp) => {
|
||||||
console.log(`Have no check of MODEL in API: ${RESTUrl(request)}`);
|
if (isNullOrUndefined(checker)) {
|
||||||
resolve(value.data);
|
console.log(`Have no check of MODEL in API: ${RESTUrl(request)}`);
|
||||||
} else if (checker(value.data)) {
|
resolve(value.data);
|
||||||
resolve(value.data);
|
} else if (checker === undefined || checker(value.data)) {
|
||||||
} else {
|
resolve(value.data);
|
||||||
reject({
|
} else {
|
||||||
time: Date().toString(),
|
reject({
|
||||||
status: 950,
|
name: "Model check fail",
|
||||||
error: "REST Fail to verify the data",
|
time: Date().toString(),
|
||||||
statusMessage: "API cast ERROR",
|
status: 950,
|
||||||
message: "api.ts Check type as fail"
|
error: "REST Fail to verify the data",
|
||||||
} as RestErrorResponse);
|
statusMessage: "API cast ERROR",
|
||||||
}
|
message: "api.ts Check type as fail",
|
||||||
}).catch((reason: RestErrorResponse) => {
|
} as RestErrorResponse);
|
||||||
reject(reason);
|
}
|
||||||
});
|
})
|
||||||
});
|
.catch((reason: RestErrorResponse) => {
|
||||||
}
|
reject(reason);
|
||||||
export function RESTRequestJsonArray<TYPE>(request: RESTRequestType, checker: (data: any) => data is TYPE): Promise<TYPE[]> {
|
});
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
RESTRequest(request).then((value: ModelResponseHttp) => {
|
|
||||||
if (isArrayOf(value.data, checker)) {
|
|
||||||
resolve(value.data);
|
|
||||||
} else {
|
|
||||||
reject({
|
|
||||||
time: Date().toString(),
|
|
||||||
status: 950,
|
|
||||||
error: "REST Fail to verify the data",
|
|
||||||
statusMessage: "API cast ERROR",
|
|
||||||
message: "api.ts Check type as fail"
|
|
||||||
} as RestErrorResponse);
|
|
||||||
}
|
|
||||||
}).catch((reason: RestErrorResponse) => {
|
|
||||||
reject(reason);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RESTRequestVoid(request: RESTRequestType): Promise<void> {
|
export function RESTRequestVoid(request: RESTRequestType): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
RESTRequest(request).then((value: ModelResponseHttp) => {
|
RESTRequest(request)
|
||||||
resolve();
|
.then((value: ModelResponseHttp) => {
|
||||||
}).catch((reason: RestErrorResponse) => {
|
resolve();
|
||||||
reject(reason);
|
})
|
||||||
});
|
.catch((reason: RestErrorResponse) => {
|
||||||
|
reject(reason);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ export class applicationUserRightEditScene implements OnInit {
|
|||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}
|
}
|
||||||
updateButtonDisabled: number | undefined = undefined;
|
updateButtonDisabled: number | undefined = undefined;
|
||||||
dataUpdate: object = {}
|
dataUpdate: { [key: string]: object; } = {}
|
||||||
|
|
||||||
onEditState(value: number) {
|
onEditState(value: number) {
|
||||||
console.log(`changeState : ${JSON.stringify(value, null, 2)}`);
|
console.log(`changeState : ${JSON.stringify(value, null, 2)}`);
|
||||||
@ -147,7 +147,7 @@ export class applicationUserRightEditScene implements OnInit {
|
|||||||
// we do not change the main ref ==> notify angular that something have change and need to be re-render???
|
// we do not change the main ref ==> notify angular that something have change and need to be re-render???
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}
|
}
|
||||||
onEditValues(value: any) {
|
onEditValues(value: { [key: string]: object; }) {
|
||||||
console.log(`onDeltaValues : ${JSON.stringify(value, null, 2)}`);
|
console.log(`onDeltaValues : ${JSON.stringify(value, null, 2)}`);
|
||||||
this.dataUpdate = value;
|
this.dataUpdate = value;
|
||||||
// we do not change the main ref ==> notify angular that something have change and need to be re-render???
|
// we do not change the main ref ==> notify angular that something have change and need to be re-render???
|
||||||
|
@ -219,7 +219,7 @@ export class AdminUserService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateApplicationRights(userId: number, applicationId: number, dataUpdate: object): Promise<any> {
|
updateApplicationRights(userId: number, applicationId: number, dataUpdate: { [key: string]: object; }): Promise<any> {
|
||||||
return UserResource.patchApplicationRight({
|
return UserResource.patchApplicationRight({
|
||||||
restConfig: this.getRestConfig(),
|
restConfig: this.getRestConfig(),
|
||||||
params: {
|
params: {
|
||||||
|
Loading…
Reference in New Issue
Block a user