Add API endpoint for updating basic character info.
This commit is contained in:
parent
c42f13af52
commit
ea4723cbe5
|
@ -57,43 +57,47 @@ message CofdSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
string name = 1;
|
string name = 1;
|
||||||
string player = 2;
|
string gender = 2;
|
||||||
string campaign = 3;
|
string concept = 3;
|
||||||
string description = 4;
|
int32 age = 4;
|
||||||
|
|
||||||
int32 strength = 6;
|
string player = 5;
|
||||||
int32 dexterity = 7;
|
string chronicle = 6;
|
||||||
int32 stamina = 8;
|
string description = 7;
|
||||||
|
|
||||||
int32 intelligence = 9;
|
int32 strength = 8;
|
||||||
int32 wits = 10;
|
int32 dexterity = 9;
|
||||||
int32 resolve = 11;
|
int32 stamina = 10;
|
||||||
|
|
||||||
int32 presence = 12;
|
int32 intelligence = 11;
|
||||||
int32 manipulation = 13;
|
int32 wits = 12;
|
||||||
int32 composure = 14;
|
int32 resolve = 13;
|
||||||
|
|
||||||
map<string, Skill> physical_skills = 16;
|
int32 presence = 14;
|
||||||
map<string, Skill> mental_skills = 17;
|
int32 manipulation = 15;
|
||||||
map<string, Skill> social_skills = 18;
|
int32 composure = 16;
|
||||||
|
|
||||||
repeated Merit merits = 15;
|
map<string, Skill> physical_skills = 17;
|
||||||
repeated Condition conditions = 19;
|
map<string, Skill> mental_skills = 18;
|
||||||
|
map<string, Skill> social_skills = 19;
|
||||||
|
|
||||||
int32 size = 20;
|
repeated Merit merits = 20;
|
||||||
int32 health = 21;
|
repeated Condition conditions = 21;
|
||||||
int32 willpower = 22;
|
|
||||||
int32 experience_points = 23;
|
|
||||||
int32 beats = 24;
|
|
||||||
|
|
||||||
repeated Item items = 25;
|
int32 size = 22;
|
||||||
repeated Attack attacks = 26;
|
int32 health = 23;
|
||||||
|
int32 willpower = 24;
|
||||||
|
int32 experience_points = 25;
|
||||||
|
int32 beats = 26;
|
||||||
|
|
||||||
map<string, string> other_data = 27;
|
repeated Item items = 27;
|
||||||
|
repeated Attack attacks = 28;
|
||||||
|
|
||||||
|
map<string, string> other_data = 29;
|
||||||
|
|
||||||
oneof system_fields {
|
oneof system_fields {
|
||||||
CoreFields core = 28;
|
CoreFields core = 30;
|
||||||
MageFields mage = 29;
|
MageFields mage = 31;
|
||||||
ChangelingFields changeling = 30;
|
ChangelingFields changeling = 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,14 @@ package models.proto.cofd.api;
|
||||||
//derivative system) character sheet. This is a straight overwrite of
|
//derivative system) character sheet. This is a straight overwrite of
|
||||||
//all basic information on the sheet.
|
//all basic information on the sheet.
|
||||||
message UpdateBasicInfoRequest {
|
message UpdateBasicInfoRequest {
|
||||||
string name = 1;
|
string owner = 1;
|
||||||
string gender = 2;
|
int32 character_id = 2;
|
||||||
string concept = 3;
|
|
||||||
string chronicle = 4;
|
string name = 3;
|
||||||
int32 age = 5;
|
string gender = 4;
|
||||||
|
string concept = 5;
|
||||||
|
string chronicle = 6;
|
||||||
|
int32 age = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Generic "did something succeed or not" response.
|
//Generic "did something succeed or not" response.
|
||||||
|
|
|
@ -5,6 +5,12 @@ import * as jspb from "google-protobuf";
|
||||||
import * as cofd_pb from "./cofd_pb";
|
import * as cofd_pb from "./cofd_pb";
|
||||||
|
|
||||||
export class UpdateBasicInfoRequest extends jspb.Message {
|
export class UpdateBasicInfoRequest extends jspb.Message {
|
||||||
|
getOwner(): string;
|
||||||
|
setOwner(value: string): void;
|
||||||
|
|
||||||
|
getCharacterId(): number;
|
||||||
|
setCharacterId(value: number): void;
|
||||||
|
|
||||||
getName(): string;
|
getName(): string;
|
||||||
setName(value: string): void;
|
setName(value: string): void;
|
||||||
|
|
||||||
|
@ -32,6 +38,8 @@ export class UpdateBasicInfoRequest extends jspb.Message {
|
||||||
|
|
||||||
export namespace UpdateBasicInfoRequest {
|
export namespace UpdateBasicInfoRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
|
owner: string,
|
||||||
|
characterId: number,
|
||||||
name: string,
|
name: string,
|
||||||
gender: string,
|
gender: string,
|
||||||
concept: string,
|
concept: string,
|
||||||
|
|
|
@ -224,11 +224,13 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.toObject = function
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.toObject = function(includeInstance, msg) {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.toObject = function(includeInstance, msg) {
|
||||||
var f, obj = {
|
var f, obj = {
|
||||||
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
owner: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
||||||
gender: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
characterId: jspb.Message.getFieldWithDefault(msg, 2, 0),
|
||||||
concept: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
name: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
||||||
chronicle: jspb.Message.getFieldWithDefault(msg, 4, ""),
|
gender: jspb.Message.getFieldWithDefault(msg, 4, ""),
|
||||||
age: jspb.Message.getFieldWithDefault(msg, 5, 0)
|
concept: jspb.Message.getFieldWithDefault(msg, 5, ""),
|
||||||
|
chronicle: jspb.Message.getFieldWithDefault(msg, 6, ""),
|
||||||
|
age: jspb.Message.getFieldWithDefault(msg, 7, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (includeInstance) {
|
if (includeInstance) {
|
||||||
|
@ -267,21 +269,29 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.deserializeBinaryFromReader =
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case 1:
|
case 1:
|
||||||
var value = /** @type {string} */ (reader.readString());
|
var value = /** @type {string} */ (reader.readString());
|
||||||
msg.setName(value);
|
msg.setOwner(value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
var value = /** @type {string} */ (reader.readString());
|
var value = /** @type {number} */ (reader.readInt32());
|
||||||
msg.setGender(value);
|
msg.setCharacterId(value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
var value = /** @type {string} */ (reader.readString());
|
var value = /** @type {string} */ (reader.readString());
|
||||||
msg.setConcept(value);
|
msg.setName(value);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
var value = /** @type {string} */ (reader.readString());
|
var value = /** @type {string} */ (reader.readString());
|
||||||
msg.setChronicle(value);
|
msg.setGender(value);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
var value = /** @type {string} */ (reader.readString());
|
||||||
|
msg.setConcept(value);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
var value = /** @type {string} */ (reader.readString());
|
||||||
|
msg.setChronicle(value);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
var value = /** @type {number} */ (reader.readInt32());
|
var value = /** @type {number} */ (reader.readInt32());
|
||||||
msg.setAge(value);
|
msg.setAge(value);
|
||||||
break;
|
break;
|
||||||
|
@ -314,38 +324,52 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.serializeBinary = f
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.serializeBinaryToWriter = function(message, writer) {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.serializeBinaryToWriter = function(message, writer) {
|
||||||
var f = undefined;
|
var f = undefined;
|
||||||
f = message.getName();
|
f = message.getOwner();
|
||||||
if (f.length > 0) {
|
if (f.length > 0) {
|
||||||
writer.writeString(
|
writer.writeString(
|
||||||
1,
|
1,
|
||||||
f
|
f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
f = message.getGender();
|
f = message.getCharacterId();
|
||||||
if (f.length > 0) {
|
if (f !== 0) {
|
||||||
writer.writeString(
|
writer.writeInt32(
|
||||||
2,
|
2,
|
||||||
f
|
f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
f = message.getConcept();
|
f = message.getName();
|
||||||
if (f.length > 0) {
|
if (f.length > 0) {
|
||||||
writer.writeString(
|
writer.writeString(
|
||||||
3,
|
3,
|
||||||
f
|
f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
f = message.getChronicle();
|
f = message.getGender();
|
||||||
if (f.length > 0) {
|
if (f.length > 0) {
|
||||||
writer.writeString(
|
writer.writeString(
|
||||||
4,
|
4,
|
||||||
f
|
f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
f = message.getConcept();
|
||||||
|
if (f.length > 0) {
|
||||||
|
writer.writeString(
|
||||||
|
5,
|
||||||
|
f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
f = message.getChronicle();
|
||||||
|
if (f.length > 0) {
|
||||||
|
writer.writeString(
|
||||||
|
6,
|
||||||
|
f
|
||||||
|
);
|
||||||
|
}
|
||||||
f = message.getAge();
|
f = message.getAge();
|
||||||
if (f !== 0) {
|
if (f !== 0) {
|
||||||
writer.writeInt32(
|
writer.writeInt32(
|
||||||
5,
|
7,
|
||||||
f
|
f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -353,10 +377,10 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.serializeBinaryToWriter = fun
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* optional string name = 1;
|
* optional string owner = 1;
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getName = function() {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getOwner = function() {
|
||||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -365,34 +389,34 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getName = function(
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setName = function(value) {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setOwner = function(value) {
|
||||||
return jspb.Message.setProto3StringField(this, 1, value);
|
return jspb.Message.setProto3StringField(this, 1, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* optional string gender = 2;
|
* optional int32 character_id = 2;
|
||||||
* @return {string}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getGender = function() {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getCharacterId = function() {
|
||||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
|
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} value
|
* @param {number} value
|
||||||
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setGender = function(value) {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setCharacterId = function(value) {
|
||||||
return jspb.Message.setProto3StringField(this, 2, value);
|
return jspb.Message.setProto3IntField(this, 2, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* optional string concept = 3;
|
* optional string name = 3;
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getConcept = function() {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getName = function() {
|
||||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
|
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -401,16 +425,16 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getConcept = functi
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setConcept = function(value) {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setName = function(value) {
|
||||||
return jspb.Message.setProto3StringField(this, 3, value);
|
return jspb.Message.setProto3StringField(this, 3, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* optional string chronicle = 4;
|
* optional string gender = 4;
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getChronicle = function() {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getGender = function() {
|
||||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
|
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -419,17 +443,53 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getChronicle = func
|
||||||
* @param {string} value
|
* @param {string} value
|
||||||
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setChronicle = function(value) {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setGender = function(value) {
|
||||||
return jspb.Message.setProto3StringField(this, 4, value);
|
return jspb.Message.setProto3StringField(this, 4, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* optional int32 age = 5;
|
* optional string concept = 5;
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getConcept = function() {
|
||||||
|
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} value
|
||||||
|
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
||||||
|
*/
|
||||||
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setConcept = function(value) {
|
||||||
|
return jspb.Message.setProto3StringField(this, 5, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* optional string chronicle = 6;
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getChronicle = function() {
|
||||||
|
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} value
|
||||||
|
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
||||||
|
*/
|
||||||
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setChronicle = function(value) {
|
||||||
|
return jspb.Message.setProto3StringField(this, 6, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* optional int32 age = 7;
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getAge = function() {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getAge = function() {
|
||||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
|
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -438,7 +498,7 @@ proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.getAge = function()
|
||||||
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
* @return {!proto.models.proto.cofd.api.UpdateBasicInfoRequest} returns this
|
||||||
*/
|
*/
|
||||||
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setAge = function(value) {
|
proto.models.proto.cofd.api.UpdateBasicInfoRequest.prototype.setAge = function(value) {
|
||||||
return jspb.Message.setProto3IntField(this, 5, value);
|
return jspb.Message.setProto3IntField(this, 7, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,11 +67,20 @@ export class CofdSheet extends jspb.Message {
|
||||||
getName(): string;
|
getName(): string;
|
||||||
setName(value: string): void;
|
setName(value: string): void;
|
||||||
|
|
||||||
|
getGender(): string;
|
||||||
|
setGender(value: string): void;
|
||||||
|
|
||||||
|
getConcept(): string;
|
||||||
|
setConcept(value: string): void;
|
||||||
|
|
||||||
|
getAge(): number;
|
||||||
|
setAge(value: number): void;
|
||||||
|
|
||||||
getPlayer(): string;
|
getPlayer(): string;
|
||||||
setPlayer(value: string): void;
|
setPlayer(value: string): void;
|
||||||
|
|
||||||
getCampaign(): string;
|
getChronicle(): string;
|
||||||
setCampaign(value: string): void;
|
setChronicle(value: string): void;
|
||||||
|
|
||||||
getDescription(): string;
|
getDescription(): string;
|
||||||
setDescription(value: string): void;
|
setDescription(value: string): void;
|
||||||
|
@ -175,8 +184,11 @@ export class CofdSheet extends jspb.Message {
|
||||||
export namespace CofdSheet {
|
export namespace CofdSheet {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
name: string,
|
name: string,
|
||||||
|
gender: string,
|
||||||
|
concept: string,
|
||||||
|
age: number,
|
||||||
player: string,
|
player: string,
|
||||||
campaign: string,
|
chronicle: string,
|
||||||
description: string,
|
description: string,
|
||||||
strength: number,
|
strength: number,
|
||||||
dexterity: number,
|
dexterity: number,
|
||||||
|
@ -353,9 +365,9 @@ export namespace CofdSheet {
|
||||||
|
|
||||||
export enum SystemFieldsCase {
|
export enum SystemFieldsCase {
|
||||||
SYSTEM_FIELDS_NOT_SET = 0,
|
SYSTEM_FIELDS_NOT_SET = 0,
|
||||||
CORE = 28,
|
CORE = 30,
|
||||||
MAGE = 29,
|
MAGE = 31,
|
||||||
CHANGELING = 30,
|
CHANGELING = 32,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,16 @@ tonic::include_proto!("models.proto.cofd");
|
||||||
pub mod api {
|
pub mod api {
|
||||||
//include!(concat!(env!("OUT_DIR"), "/models.proto.cofd.api.rs"));
|
//include!(concat!(env!("OUT_DIR"), "/models.proto.cofd.api.rs"));
|
||||||
tonic::include_proto!("models.proto.cofd.api");
|
tonic::include_proto!("models.proto.cofd.api");
|
||||||
|
|
||||||
|
/// Helpers for the ApiResult class.
|
||||||
|
impl ApiResult {
|
||||||
|
pub fn success() -> Self {
|
||||||
|
ApiResult {
|
||||||
|
success: true,
|
||||||
|
error: "".to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default mental skill names for a regular Chronicles of Darkness
|
/// Default mental skill names for a regular Chronicles of Darkness
|
||||||
|
|
|
@ -37,9 +37,22 @@ fn find_skill<'a>(sheet: &'a mut CofdSheet, skill_name: &'a str) -> Option<&'a m
|
||||||
find_skill_entry(sheet, skill_name).map(|entry| entry.into_mut())
|
find_skill_entry(sheet, skill_name).map(|entry| entry.into_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/rpc/cofd/update_basic_info", data = "<info>")]
|
#[post("/rpc/cofd/update_basic_info", data = "<req>")]
|
||||||
pub(super) fn update_basic_info<'a>(info: Proto<UpdateBasicInfoRequest>) -> &'a str {
|
pub(super) async fn update_basic_info<'a>(
|
||||||
"lol"
|
req: Proto<UpdateBasicInfoRequest>,
|
||||||
|
conn: TenebrousDbConn<'_>,
|
||||||
|
logged_in_user: Option<&User>,
|
||||||
|
) -> Result<Proto<ApiResult>, Error> {
|
||||||
|
let mut character = load_character(&conn, logged_in_user, &req.owner, req.character_id).await?;
|
||||||
|
let mut sheet: CofdSheet = character.try_deserialize()?;
|
||||||
|
|
||||||
|
sheet.name = req.name.clone();
|
||||||
|
sheet.gender = req.gender.clone();
|
||||||
|
sheet.concept = req.concept.clone();
|
||||||
|
|
||||||
|
character.update_data(&sheet)?;
|
||||||
|
conn.update_character_sheet(&character).await?;
|
||||||
|
Ok(Proto(ApiResult::success()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/rpc/cofd/update_attribute_value", data = "<req>")]
|
#[post("/rpc/cofd/update_attribute_value", data = "<req>")]
|
||||||
|
|
Loading…
Reference in New Issue