Skip to content

Commit f6cdf46

Browse files
committed
Update DTOs
1 parent 8539552 commit f6cdf46

3 files changed

Lines changed: 72 additions & 41 deletions

File tree

MyApp.Tests/SerializationTests.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using MyApp.ServiceModel;
2+
using NUnit.Framework;
3+
using ServiceStack;
4+
using ServiceStack.Text;
5+
6+
namespace MyApp.Tests;
7+
8+
public class SerializationTests
9+
{
10+
[Test]
11+
public void Can_deserialize_UpdateGenerationAsset()
12+
{
13+
var to = new UpdateGenerationAsset
14+
{
15+
GenerationId = "7edb51ed05474b8186a065e2688ad8ba",
16+
AssetUrl = "/artifacts/45ef7dcb566b7ee223287fc0744683831fb24418b169828142b6a4d96d6a6af9.webp",
17+
Rating = Rating.PG13
18+
};
19+
var json = to.ToJson();
20+
var fromJson = json.FromJson<UpdateGenerationAsset>();
21+
Assert.That(fromJson.GenerationId, Is.EqualTo(to.GenerationId));
22+
Assert.That(fromJson.AssetUrl, Is.EqualTo(to.AssetUrl));
23+
Assert.That(fromJson.Rating, Is.EqualTo(to.Rating));
24+
25+
fromJson = ClientConfig.FromJson<UpdateGenerationAsset>(json);
26+
Assert.That(fromJson.GenerationId, Is.EqualTo(to.GenerationId));
27+
Assert.That(fromJson.AssetUrl, Is.EqualTo(to.AssetUrl));
28+
Assert.That(fromJson.Rating, Is.EqualTo(to.Rating));
29+
}
30+
}

MyApp/wwwroot/mjs/dtos.mjs

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Options:
2-
Date: 2025-10-01 09:26:59
3-
Version: 8.81
2+
Date: 2025-12-10 21:13:05
3+
Version: 10.05
44
Tip: To override a DTO option, remove "//" prefix before updating
55
BaseUrl: http://localhost:5000
66
@@ -1476,6 +1476,24 @@ export class OpenAiTools {
14761476
* @description The type of the tool. Currently, only function is supported. */
14771477
type;
14781478
}
1479+
export class OwnerAgentInfo extends AgentInfo {
1480+
/** @param {{deviceId?:string,userId?:string,userName?:string,lastIp?:string,status?:string,modelSettings?:{ [index:string]: ModelSettings; },settings?:ComfyAgentSettings,id?:number,shortId?:string,userId?:string,gpus?:GpuInfo[],nodes?:string[],models?:{ [index:string]: string[]; },languageModels?:string[],requirePip?:string[],requireNodes?:string[],requireModels?:string[],installedPip?:string[],installedNodes?:string[],installedModels?:string[],hiddenModels?:string[],enabled?:boolean,offlineDate?:string,createdDate?:string,modifiedDate?:string,lastUpdate?:string,queueCount?:number,devicePool?:string}} [init] */
1481+
constructor(init) { super(init); Object.assign(this, init) }
1482+
/** @type {string} */
1483+
deviceId;
1484+
/** @type {string} */
1485+
userId;
1486+
/** @type {?string} */
1487+
userName;
1488+
/** @type {?string} */
1489+
lastIp;
1490+
/** @type {?string} */
1491+
status;
1492+
/** @type {?{ [index:string]: ModelSettings; }} */
1493+
modelSettings;
1494+
/** @type {ComfyAgentSettings} */
1495+
settings;
1496+
}
14791497
export class GetPendingArtifactTasksResponse {
14801498
/** @param {{missingArtifacts?:number[],existingCaptionArtifacts?:number[],existingDescribeArtifacts?:number[],requeueCaptionArtifacts?:number[],requeueDescribeArtifacts?:number[],responseStatus?:ResponseStatus}} [init] */
14811499
constructor(init) { Object.assign(this, init) }
@@ -1726,24 +1744,6 @@ export class GetAppDataResponse {
17261744
/** @type {?ResponseStatus} */
17271745
responseStatus;
17281746
}
1729-
export class OwnerAgentInfo extends AgentInfo {
1730-
/** @param {{deviceId?:string,userId?:string,userName?:string,lastIp?:string,status?:string,modelSettings?:{ [index:string]: ModelSettings; },settings?:ComfyAgentSettings,id?:number,shortId?:string,userId?:string,gpus?:GpuInfo[],nodes?:string[],models?:{ [index:string]: string[]; },languageModels?:string[],requirePip?:string[],requireNodes?:string[],requireModels?:string[],installedPip?:string[],installedNodes?:string[],installedModels?:string[],hiddenModels?:string[],enabled?:boolean,offlineDate?:string,createdDate?:string,modifiedDate?:string,lastUpdate?:string,queueCount?:number,devicePool?:string}} [init] */
1731-
constructor(init) { super(init); Object.assign(this, init) }
1732-
/** @type {string} */
1733-
deviceId;
1734-
/** @type {string} */
1735-
userId;
1736-
/** @type {?string} */
1737-
userName;
1738-
/** @type {?string} */
1739-
lastIp;
1740-
/** @type {?string} */
1741-
status;
1742-
/** @type {?{ [index:string]: ModelSettings; }} */
1743-
modelSettings;
1744-
/** @type {ComfyAgentSettings} */
1745-
settings;
1746-
}
17471747
export class UpdateComfyAgentSettingsResponse {
17481748
/** @param {{result?:OwnerAgentInfo,responseStatus?:ResponseStatus}} [init] */
17491749
constructor(init) { Object.assign(this, init) }
@@ -2200,33 +2200,33 @@ export class ChatCompletion {
22002200
export class AuthenticateResponse {
22012201
/** @param {{userId?:string,sessionId?:string,userName?:string,displayName?:string,referrerUrl?:string,bearerToken?:string,refreshToken?:string,refreshTokenExpiry?:string,profileUrl?:string,roles?:string[],permissions?:string[],authProvider?:string,responseStatus?:ResponseStatus,meta?:{ [index:string]: string; }}} [init] */
22022202
constructor(init) { Object.assign(this, init) }
2203-
/** @type {string} */
2203+
/** @type {?string} */
22042204
userId;
2205-
/** @type {string} */
2205+
/** @type {?string} */
22062206
sessionId;
2207-
/** @type {string} */
2207+
/** @type {?string} */
22082208
userName;
2209-
/** @type {string} */
2209+
/** @type {?string} */
22102210
displayName;
2211-
/** @type {string} */
2211+
/** @type {?string} */
22122212
referrerUrl;
2213-
/** @type {string} */
2213+
/** @type {?string} */
22142214
bearerToken;
2215-
/** @type {string} */
2215+
/** @type {?string} */
22162216
refreshToken;
22172217
/** @type {?string} */
22182218
refreshTokenExpiry;
2219-
/** @type {string} */
2219+
/** @type {?string} */
22202220
profileUrl;
2221-
/** @type {string[]} */
2221+
/** @type {?string[]} */
22222222
roles;
2223-
/** @type {string[]} */
2223+
/** @type {?string[]} */
22242224
permissions;
2225-
/** @type {string} */
2225+
/** @type {?string} */
22262226
authProvider;
2227-
/** @type {ResponseStatus} */
2227+
/** @type {?ResponseStatus} */
22282228
responseStatus;
2229-
/** @type {{ [index:string]: string; }} */
2229+
/** @type {?{ [index:string]: string; }} */
22302230
meta;
22312231
}
22322232
export class GetPendingArtifactTasks {
@@ -3498,24 +3498,24 @@ export class Authenticate {
34983498
/** @param {{provider?:string,userName?:string,password?:string,rememberMe?:boolean,accessToken?:string,accessTokenSecret?:string,returnUrl?:string,errorView?:string,meta?:{ [index:string]: string; }}} [init] */
34993499
constructor(init) { Object.assign(this, init) }
35003500
/**
3501-
* @type {string}
3501+
* @type {?string}
35023502
* @description AuthProvider, e.g. credentials */
35033503
provider;
3504-
/** @type {string} */
3504+
/** @type {?string} */
35053505
userName;
3506-
/** @type {string} */
3506+
/** @type {?string} */
35073507
password;
35083508
/** @type {?boolean} */
35093509
rememberMe;
3510-
/** @type {string} */
3510+
/** @type {?string} */
35113511
accessToken;
3512-
/** @type {string} */
3512+
/** @type {?string} */
35133513
accessTokenSecret;
3514-
/** @type {string} */
3514+
/** @type {?string} */
35153515
returnUrl;
3516-
/** @type {string} */
3516+
/** @type {?string} */
35173517
errorView;
3518-
/** @type {{ [index:string]: string; }} */
3518+
/** @type {?{ [index:string]: string; }} */
35193519
meta;
35203520
getTypeName() { return 'Authenticate' }
35213521
getMethod() { return 'POST' }

MyApp/wwwroot/pages/components/Feed.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ export default {
402402

403403
async function changeRating(generation, asset, rating) {
404404
error.value = null
405+
rating = formatRating(rating)
405406
const api = await store.updateGenerationAsset(generation, asset, { rating })
406407
error.value = api.error
407408
}

0 commit comments

Comments
 (0)