Skip to content

Commit

Permalink
Support namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
akhromets committed May 8, 2024
1 parent 36a27ef commit c5f5475
Show file tree
Hide file tree
Showing 15 changed files with 493 additions and 23 deletions.
21 changes: 21 additions & 0 deletions .snapshot/all/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export interface ICategory {
name: $types.TypeOrUndefinedNullable<string>;
}

export interface IMyProduct.Core.Models.Feedback {
name: $types.TypeOrUndefinedNullable<string>;
}

export interface IProduct {
category: $types.TypeOrUndefinedNullable<ICategory>;
colors: $types.TypeOrUndefined<string[]>;
Expand Down Expand Up @@ -57,6 +61,23 @@ export class Category {
}
}

export class MyProduct.Core.Models.Feedback {
public name: $types.TypeOrUndefinedNullable<string> = undefined;
private __myProduct.Core.Models.Feedback!: string;

public static toDTO(model: Partial<MyProduct.Core.Models.Feedback>): IMyProduct.Core.Models.Feedback {
return {
name: model.name,
};
}

public static fromDTO(dto: IMyProduct.Core.Models.Feedback): MyProduct.Core.Models.Feedback {
const model = new MyProduct.Core.Models.Feedback();
model.name = dto.name;
return model;
}
}

export class Product {
public category: $types.TypeOrUndefinedNullable<Category> = undefined;
public colors: string[] = [];
Expand Down
16 changes: 16 additions & 0 deletions .snapshot/all/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ export class CategoryService extends BaseHttpService {
}
}

@Injectable({
providedIn: 'root'
})
export class FeedbackService extends BaseHttpService {
constructor(http: HttpClient) {
super(getBasePath('', '/api/feedback'), http);
}

public postFeedback(myProduct.Core.Models.Feedback: $models.IMyProduct.Core.Models.Feedback): Observable<void> {
return this.post<void>(
``,
myProduct.Core.Models.Feedback,
);
}
}

@Injectable({
providedIn: 'root'
})
Expand Down
117 changes: 117 additions & 0 deletions .snapshot/joinNamespace/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { Guid } from './Guid';
import { toDateIn, toDateOut } from './date-converters';
import type * as $types from './types';

export enum ProductStatus {
InStock = 0,
OutOfStock = -1,
UnderTheOrder = 1
}

export interface ICategory {
name: $types.TypeOrUndefinedNullable<string>;
}

export interface IMyProductCoreModelsFeedback {
name: $types.TypeOrUndefinedNullable<string>;
}

export interface IProduct {
category: $types.TypeOrUndefinedNullable<ICategory>;
colors: $types.TypeOrUndefined<string[]>;
expireDate: $types.TypeOrUndefined<string>;
externalId: $types.TypeOrUndefinedNullable<string>;
id: $types.TypeOrUndefined<string>;
modifyDates: $types.TypeOrUndefined<string[]>;
name: $types.TypeOrUndefinedNullable<string>;
status: $types.TypeOrUndefined<ProductStatus>;
}

export interface IProductIdentityDTO {
id: $types.TypeOrUndefined<string>;
}

export class ProductIdentityDTO {
public id: Guid;
private __productIdentityDTO!: string;

constructor(id?: $types.TypeOrUndefined<Guid | string>) {
this.id = new Guid(id);
}

public static toDTO(id: Guid): IProductIdentityDTO {
return { id: id.toString() };
}
}

export class Category {
public name: $types.TypeOrUndefinedNullable<string> = undefined;
private __category!: string;

public static toDTO(model: Partial<Category>): ICategory {
return {
name: model.name,
};
}

public static fromDTO(dto: ICategory): Category {
const model = new Category();
model.name = dto.name;
return model;
}
}

export class MyProductCoreModelsFeedback {
public name: $types.TypeOrUndefinedNullable<string> = undefined;
private __myProductCoreModelsFeedback!: string;

public static toDTO(model: Partial<MyProductCoreModelsFeedback>): IMyProductCoreModelsFeedback {
return {
name: model.name,
};
}

public static fromDTO(dto: IMyProductCoreModelsFeedback): MyProductCoreModelsFeedback {
const model = new MyProductCoreModelsFeedback();
model.name = dto.name;
return model;
}
}

export class Product {
public category: $types.TypeOrUndefinedNullable<Category> = undefined;
public colors: string[] = [];
public expireDate: $types.TypeOrUndefined<Date> = undefined;
public externalId: $types.TypeOrUndefinedNullable<Guid> = undefined;
public id: $types.TypeOrUndefined<Guid> = undefined;
public modifyDates: Date[] = [];
public name: $types.TypeOrUndefinedNullable<string> = undefined;
public status: $types.TypeOrUndefined<ProductStatus> = undefined;
private __product!: string;

public static toDTO(model: Partial<Product>): IProduct {
return {
category: model.category ? Category.toDTO(model.category) : undefined,
colors: model.colors,
expireDate: toDateOut(model.expireDate),
externalId: model.externalId ? model.externalId.toString() : null,
id: model.id ? model.id.toString() : Guid.empty.toString(),
modifyDates: model.modifyDates ? model.modifyDates.map(toDateOut) : undefined,
name: model.name,
status: model.status,
};
}

public static fromDTO(dto: IProduct): Product {
const model = new Product();
model.category = dto.category ? Category.fromDTO(dto.category) : undefined;
model.colors = dto.colors ? dto.colors : [];
model.expireDate = toDateIn(dto.expireDate);
model.externalId = dto.externalId ? new Guid(dto.externalId) : null;
model.id = new Guid(dto.id);
model.modifyDates = dto.modifyDates ? dto.modifyDates.map(toDateIn) : [];
model.name = dto.name;
model.status = dto.status;
return model;
}
}
117 changes: 117 additions & 0 deletions .snapshot/truncateNamespace/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { Guid } from './Guid';
import { toDateIn, toDateOut } from './date-converters';
import type * as $types from './types';

export enum ProductStatus {
InStock = 0,
OutOfStock = -1,
UnderTheOrder = 1
}

export interface ICategory {
name: $types.TypeOrUndefinedNullable<string>;
}

export interface IFeedback {
name: $types.TypeOrUndefinedNullable<string>;
}

export interface IProduct {
category: $types.TypeOrUndefinedNullable<ICategory>;
colors: $types.TypeOrUndefined<string[]>;
expireDate: $types.TypeOrUndefined<string>;
externalId: $types.TypeOrUndefinedNullable<string>;
id: $types.TypeOrUndefined<string>;
modifyDates: $types.TypeOrUndefined<string[]>;
name: $types.TypeOrUndefinedNullable<string>;
status: $types.TypeOrUndefined<ProductStatus>;
}

export interface IProductIdentityDTO {
id: $types.TypeOrUndefined<string>;
}

export class ProductIdentityDTO {
public id: Guid;
private __productIdentityDTO!: string;

constructor(id?: $types.TypeOrUndefined<Guid | string>) {
this.id = new Guid(id);
}

public static toDTO(id: Guid): IProductIdentityDTO {
return { id: id.toString() };
}
}

export class Category {
public name: $types.TypeOrUndefinedNullable<string> = undefined;
private __category!: string;

public static toDTO(model: Partial<Category>): ICategory {
return {
name: model.name,
};
}

public static fromDTO(dto: ICategory): Category {
const model = new Category();
model.name = dto.name;
return model;
}
}

export class Feedback {
public name: $types.TypeOrUndefinedNullable<string> = undefined;
private __feedback!: string;

public static toDTO(model: Partial<Feedback>): IFeedback {
return {
name: model.name,
};
}

public static fromDTO(dto: IFeedback): Feedback {
const model = new Feedback();
model.name = dto.name;
return model;
}
}

export class Product {
public category: $types.TypeOrUndefinedNullable<Category> = undefined;
public colors: string[] = [];
public expireDate: $types.TypeOrUndefined<Date> = undefined;
public externalId: $types.TypeOrUndefinedNullable<Guid> = undefined;
public id: $types.TypeOrUndefined<Guid> = undefined;
public modifyDates: Date[] = [];
public name: $types.TypeOrUndefinedNullable<string> = undefined;
public status: $types.TypeOrUndefined<ProductStatus> = undefined;
private __product!: string;

public static toDTO(model: Partial<Product>): IProduct {
return {
category: model.category ? Category.toDTO(model.category) : undefined,
colors: model.colors,
expireDate: toDateOut(model.expireDate),
externalId: model.externalId ? model.externalId.toString() : null,
id: model.id ? model.id.toString() : Guid.empty.toString(),
modifyDates: model.modifyDates ? model.modifyDates.map(toDateOut) : undefined,
name: model.name,
status: model.status,
};
}

public static fromDTO(dto: IProduct): Product {
const model = new Product();
model.category = dto.category ? Category.fromDTO(dto.category) : undefined;
model.colors = dto.colors ? dto.colors : [];
model.expireDate = toDateIn(dto.expireDate);
model.externalId = dto.externalId ? new Guid(dto.externalId) : null;
model.id = new Guid(dto.id);
model.modifyDates = dto.modifyDates ? dto.modifyDates.map(toDateIn) : [];
model.name = dto.name;
model.status = dto.status;
return model;
}
}
3 changes: 2 additions & 1 deletion .snapshot/withRequestOptions/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export class FeedbackService extends BaseHttpService {
super(getBasePath('', '/api/feedback'), http);
}

public postFeedback(options?: $types.TypeOrUndefined<IAngularHttpRequestOptions>): Observable<void> {
public postFeedback(myProduct.Core.Models.Feedback: $models.IMyProduct.Core.Models.Feedback, options?: $types.TypeOrUndefined<IAngularHttpRequestOptions>): Observable<void> {
return this.post<void>(
``,
myProduct.Core.Models.Feedback,
options,
);
}
Expand Down
Loading

0 comments on commit c5f5475

Please sign in to comment.