Skip to content

Commit 8b0367b

Browse files
committed
convert int to string
1 parent 3adcf0a commit 8b0367b

File tree

3 files changed

+40
-12
lines changed

3 files changed

+40
-12
lines changed

TechStacks.Client/src/shared/dtos.ts

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Options:
2-
Date: 2026-02-14 21:34:33
2+
Date: 2026-02-19 20:21:21
33
Version: 10.06
44
Tip: To override a DTO option, remove "//" prefix before updating
55
BaseUrl: https://localhost:5001
@@ -159,9 +159,9 @@ export class Post
159159
public createdBy: string;
160160
public modified: string;
161161
public modifiedBy: string;
162-
public refId?: number;
163-
public refSource: string;
164-
public refUrn: string;
162+
public refId?: string;
163+
public refSource?: string;
164+
public refUrn?: string;
165165

166166
public constructor(init?: Partial<Post>) { (Object as any).assign(this, init); }
167167
}
@@ -1087,6 +1087,21 @@ export class GetTechnologyFavoriteDetailsResponse
10871087
public constructor(init?: Partial<GetTechnologyFavoriteDetailsResponse>) { (Object as any).assign(this, init); }
10881088
}
10891089

1090+
// @DataContract
1091+
export class StringResponse
1092+
{
1093+
// @DataMember(Order=1)
1094+
public result: string;
1095+
1096+
// @DataMember(Order=2)
1097+
public meta?: { [index:string]: string; };
1098+
1099+
// @DataMember(Order=3)
1100+
public responseStatus?: ResponseStatus;
1101+
1102+
public constructor(init?: Partial<StringResponse>) { (Object as any).assign(this, init); }
1103+
}
1104+
10901105
export class CreateTechnologyResponse
10911106
{
10921107
public result: Technology;
@@ -1748,7 +1763,7 @@ export class GetPost implements IReturn<GetPostResponse>, IGet
17481763

17491764
export class ImportNewsPost implements IReturn<CreatePostResponse>
17501765
{
1751-
public id: number;
1766+
public id: string;
17521767
// @Validate(Validator="NotEmpty")
17531768
public title: string;
17541769

@@ -1784,7 +1799,9 @@ export class CreatePost implements IReturn<CreatePostResponse>, IPost
17841799
public organizationId: number;
17851800
public type: PostType;
17861801
public categoryId: number;
1802+
// @Validate(Validator="NotEmpty")
17871803
public title: string;
1804+
17881805
public url: string;
17891806
public imageUrl: string;
17901807
public content: string;
@@ -1795,7 +1812,7 @@ export class CreatePost implements IReturn<CreatePostResponse>, IPost
17951812
public toDate?: string;
17961813
public metaType: string;
17971814
public meta: string;
1798-
public refId?: number;
1815+
public refId?: string;
17991816
public refSource?: string;
18001817
public refUrn?: string;
18011818

@@ -2201,6 +2218,17 @@ export class GetTechnologyFavoriteDetails implements IReturn<GetTechnologyFavori
22012218
public createResponse() { return new GetTechnologyFavoriteDetailsResponse(); }
22022219
}
22032220

2221+
// @Route("/tasks/syncstats")
2222+
// @ValidateRequest(Validator="IsAdmin")
2223+
export class SyncStats implements IReturn<StringResponse>, IPost
2224+
{
2225+
2226+
public constructor(init?: Partial<SyncStats>) { (Object as any).assign(this, init); }
2227+
public getTypeName() { return 'SyncStats'; }
2228+
public getMethod() { return 'POST'; }
2229+
public createResponse() { return new StringResponse(); }
2230+
}
2231+
22042232
// @Route("/technology", "POST")
22052233
export class CreateTechnology implements IReturn<CreateTechnologyResponse>, IPost
22062234
{

TechStacks.ServiceInterface/OrganizationServices.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ public async Task<CreateOrganizationForTechnologyResponse> Post(CreateOrganizati
167167
OrganizationId = organization.Id,
168168
Type = PostType.Post,
169169
Title = postTitle,
170-
Slug = postTitle.GenerateSlug(),
170+
Slug = postTitle.GenerateSlug() ?? throw new Exception("Could not generate slug from post title"),
171171
Content = postContent,
172172
ContentHtml = $"<div class='gfm ssfm'>{MarkdownConfig.Transform(postContent)}</div>",
173-
RefId = organization.RefId,
173+
RefId = organization.RefId?.ToString(),
174174
RefSource = organization.RefSource,
175175
RefUrn = organization.RefUrn,
176176
Created = now,
@@ -182,7 +182,7 @@ public async Task<CreateOrganizationForTechnologyResponse> Post(CreateOrganizati
182182
UserId = userId,
183183
UpVotes = 0,
184184
Rank = 0,
185-
TechnologyIds = technology != null ? new[] { (int)technology.Id } : null,
185+
TechnologyIds = technology != null ? [(int)technology.Id] : [],
186186
};
187187
post.Id = await Db.InsertAsync(post, selectIdentity: true);
188188

TechStacks.Tests/MigrationTasks.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ public void Create_missing_posts()
233233
OrganizationId = info.OrganizationId,
234234
Type = PostType.Post,
235235
Title = postTitle,
236-
Slug = postTitle.GenerateSlug(),
236+
Slug = postTitle.GenerateSlug() ?? throw new Exception("Could not generate slug from post title"),
237237
Content = postContent,
238238
ContentHtml = $"<div class='gfm ssfm'>{MarkdownConfig.Transform(postContent)}</div>",
239-
RefId = info.Id,
239+
RefId = info.Id.ToString(),
240240
RefSource = nameof(Technology),
241241
RefUrn = $"urn:{nameof(Technology)}:{info.Id}",
242242
Created = now,
@@ -246,7 +246,7 @@ public void Create_missing_posts()
246246
UserId = userId,
247247
UpVotes = 0,
248248
Rank = 0,
249-
TechnologyIds = new[] { info.Id },
249+
TechnologyIds = [info.Id],
250250
};
251251

252252
var postId = db.Insert(post, selectIdentity:true);

0 commit comments

Comments
 (0)