Adding Date and working on fereign keys

This commit is contained in:
2023-01-22 04:39:11 +01:00
parent 70d5a6e752
commit 7dd684e514
9 changed files with 289 additions and 21 deletions

View File

@@ -0,0 +1,34 @@
import { FormlyJsonschema } from "@ngx-formly/core/json-schema";
import { FormlyJsonschemaOptions } from "@ngx-formly/core/json-schema/formly-json-schema.service";
import { FormlyFieldConfig } from "@ngx-formly/core";
import { JSONSchema7 } from 'json-schema';
import {JsonschemasService } from "./jsonschemas.service";
import {Observable, map, tap} from "rxjs";
import {Injectable} from "@angular/core";
@Injectable({
providedIn: 'root',
})
export class CrudFormlyJsonschemaService extends FormlyJsonschema {
constructor(private jsonSchemasService: JsonschemasService) {
super();
}
override toFieldConfig(schema: JSONSchema7, options?: FormlyJsonschemaOptions): FormlyFieldConfig {
return super.toFieldConfig(schema, options);
}
getCreateFields(resourceName: string): Observable<FormlyFieldConfig> {
return this.jsonSchemasService.getCreateResource(resourceName).pipe(
map((schemas: any) => this.toFieldConfig(schemas)),
tap(console.log),
)
}
getUpdateFields(resourceName: string): Observable<FormlyFieldConfig> {
return this.jsonSchemasService.getUpdateResource(resourceName).pipe(
map((schemas: any) => this.toFieldConfig(schemas)),
tap(console.log),
)
}
}