Remove unused REST semantics from cofd API.
This commit is contained in:
parent
e6845d8c7a
commit
c42f13af52
|
@ -6,7 +6,7 @@ package models.proto.cofd.api;
|
||||||
//Update basic information about a Chronicles of Darkness (or
|
//Update basic information about a Chronicles of Darkness (or
|
||||||
//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 BasicInfo {
|
message UpdateBasicInfoRequest {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
string gender = 2;
|
string gender = 2;
|
||||||
string concept = 3;
|
string concept = 3;
|
||||||
|
@ -14,23 +14,6 @@ message BasicInfo {
|
||||||
int32 age = 5;
|
int32 age = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update all attributes in a Chronicles of Darkness character (or
|
|
||||||
//derivative system) character sheet. This is a straight overwrite of
|
|
||||||
//all basic information on the sheet.
|
|
||||||
message Attributes {
|
|
||||||
int32 strength = 1;
|
|
||||||
int32 dexterity = 2;
|
|
||||||
int32 stamina = 3;
|
|
||||||
|
|
||||||
int32 intelligence = 4;
|
|
||||||
int32 wits = 5;
|
|
||||||
int32 resolve = 6;
|
|
||||||
|
|
||||||
int32 presence = 7;
|
|
||||||
int32 manipulation = 8;
|
|
||||||
int32 composure = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Generic "did something succeed or not" response.
|
//Generic "did something succeed or not" response.
|
||||||
message ApiResult {
|
message ApiResult {
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
|
@ -45,18 +28,11 @@ message UpdateAttributeRequest {
|
||||||
int32 attribute_value = 4;
|
int32 attribute_value = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update skill entries in a Chronicles of Darkness character sheet.
|
|
||||||
//This is a straight overwrite of all skills in the sheet.
|
|
||||||
message Skills {
|
|
||||||
repeated CofdSheet.Skill physical_skills = 1;
|
|
||||||
repeated CofdSheet.Skill mental_skills = 2;
|
|
||||||
repeated CofdSheet.Skill social_skills = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Full update of a single skill
|
//Full update of a single skill
|
||||||
message SkillUpdate {
|
message UpdateSkillRequest {
|
||||||
string name = 1;
|
string character_username = 1;
|
||||||
CofdSheet.Skill skill = 2;
|
int32 character_id = 2;
|
||||||
|
CofdSheet.Skill skill = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Partial update of a single skill dot amount.
|
//Partial update of a single skill dot amount.
|
||||||
|
@ -69,12 +45,21 @@ message UpdateSkillValueRequest {
|
||||||
|
|
||||||
//Partial update of only a skill's specializations. The
|
//Partial update of only a skill's specializations. The
|
||||||
//specializations will be overwritten with the new values.
|
//specializations will be overwritten with the new values.
|
||||||
message SkillSpecializationsUpdate {
|
message UpdateSkillSpecializationsRequest {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
repeated string specializations = 2;
|
repeated string specializations = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add a Condition to a Chronicles of Darkness character sheet.
|
//Add a Condition to a Chronicles of Darkness character sheet.
|
||||||
message Condition {
|
message AddConditionRequest {
|
||||||
string name = 1;
|
string character_username = 1;
|
||||||
|
int32 character_id = 2;
|
||||||
|
string condition_name = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Remove a Condition from a Chronicles of Darkness character sheet.
|
||||||
|
message RemoveConditionRequest {
|
||||||
|
string character_username = 1;
|
||||||
|
int32 character_id = 2;
|
||||||
|
string condition_name = 3;
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
import * as jspb from "google-protobuf";
|
import * as jspb from "google-protobuf";
|
||||||
import * as cofd_pb from "./cofd_pb";
|
import * as cofd_pb from "./cofd_pb";
|
||||||
|
|
||||||
export class BasicInfo extends jspb.Message {
|
export class UpdateBasicInfoRequest extends jspb.Message {
|
||||||
getName(): string;
|
getName(): string;
|
||||||
setName(value: string): void;
|
setName(value: string): void;
|
||||||
|
|
||||||
|
@ -21,16 +21,16 @@ export class BasicInfo extends jspb.Message {
|
||||||
setAge(value: number): void;
|
setAge(value: number): void;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): BasicInfo.AsObject;
|
toObject(includeInstance?: boolean): UpdateBasicInfoRequest.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: BasicInfo): BasicInfo.AsObject;
|
static toObject(includeInstance: boolean, msg: UpdateBasicInfoRequest): UpdateBasicInfoRequest.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||||
static serializeBinaryToWriter(message: BasicInfo, writer: jspb.BinaryWriter): void;
|
static serializeBinaryToWriter(message: UpdateBasicInfoRequest, writer: jspb.BinaryWriter): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): BasicInfo;
|
static deserializeBinary(bytes: Uint8Array): UpdateBasicInfoRequest;
|
||||||
static deserializeBinaryFromReader(message: BasicInfo, reader: jspb.BinaryReader): BasicInfo;
|
static deserializeBinaryFromReader(message: UpdateBasicInfoRequest, reader: jspb.BinaryReader): UpdateBasicInfoRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace BasicInfo {
|
export namespace UpdateBasicInfoRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
name: string,
|
name: string,
|
||||||
gender: string,
|
gender: string,
|
||||||
|
@ -40,58 +40,6 @@ export namespace BasicInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Attributes extends jspb.Message {
|
|
||||||
getStrength(): number;
|
|
||||||
setStrength(value: number): void;
|
|
||||||
|
|
||||||
getDexterity(): number;
|
|
||||||
setDexterity(value: number): void;
|
|
||||||
|
|
||||||
getStamina(): number;
|
|
||||||
setStamina(value: number): void;
|
|
||||||
|
|
||||||
getIntelligence(): number;
|
|
||||||
setIntelligence(value: number): void;
|
|
||||||
|
|
||||||
getWits(): number;
|
|
||||||
setWits(value: number): void;
|
|
||||||
|
|
||||||
getResolve(): number;
|
|
||||||
setResolve(value: number): void;
|
|
||||||
|
|
||||||
getPresence(): number;
|
|
||||||
setPresence(value: number): void;
|
|
||||||
|
|
||||||
getManipulation(): number;
|
|
||||||
setManipulation(value: number): void;
|
|
||||||
|
|
||||||
getComposure(): number;
|
|
||||||
setComposure(value: number): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): Attributes.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: Attributes): Attributes.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: Attributes, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Attributes;
|
|
||||||
static deserializeBinaryFromReader(message: Attributes, reader: jspb.BinaryReader): Attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Attributes {
|
|
||||||
export type AsObject = {
|
|
||||||
strength: number,
|
|
||||||
dexterity: number,
|
|
||||||
stamina: number,
|
|
||||||
intelligence: number,
|
|
||||||
wits: number,
|
|
||||||
resolve: number,
|
|
||||||
presence: number,
|
|
||||||
manipulation: number,
|
|
||||||
composure: number,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ApiResult extends jspb.Message {
|
export class ApiResult extends jspb.Message {
|
||||||
getSuccess(): boolean;
|
getSuccess(): boolean;
|
||||||
setSuccess(value: boolean): void;
|
setSuccess(value: boolean): void;
|
||||||
|
@ -148,43 +96,12 @@ export namespace UpdateAttributeRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Skills extends jspb.Message {
|
export class UpdateSkillRequest extends jspb.Message {
|
||||||
clearPhysicalSkillsList(): void;
|
getCharacterUsername(): string;
|
||||||
getPhysicalSkillsList(): Array<cofd_pb.CofdSheet.Skill>;
|
setCharacterUsername(value: string): void;
|
||||||
setPhysicalSkillsList(value: Array<cofd_pb.CofdSheet.Skill>): void;
|
|
||||||
addPhysicalSkills(value?: cofd_pb.CofdSheet.Skill, index?: number): cofd_pb.CofdSheet.Skill;
|
|
||||||
|
|
||||||
clearMentalSkillsList(): void;
|
getCharacterId(): number;
|
||||||
getMentalSkillsList(): Array<cofd_pb.CofdSheet.Skill>;
|
setCharacterId(value: number): void;
|
||||||
setMentalSkillsList(value: Array<cofd_pb.CofdSheet.Skill>): void;
|
|
||||||
addMentalSkills(value?: cofd_pb.CofdSheet.Skill, index?: number): cofd_pb.CofdSheet.Skill;
|
|
||||||
|
|
||||||
clearSocialSkillsList(): void;
|
|
||||||
getSocialSkillsList(): Array<cofd_pb.CofdSheet.Skill>;
|
|
||||||
setSocialSkillsList(value: Array<cofd_pb.CofdSheet.Skill>): void;
|
|
||||||
addSocialSkills(value?: cofd_pb.CofdSheet.Skill, index?: number): cofd_pb.CofdSheet.Skill;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): Skills.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: Skills): Skills.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: Skills, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Skills;
|
|
||||||
static deserializeBinaryFromReader(message: Skills, reader: jspb.BinaryReader): Skills;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Skills {
|
|
||||||
export type AsObject = {
|
|
||||||
physicalSkillsList: Array<cofd_pb.CofdSheet.Skill.AsObject>,
|
|
||||||
mentalSkillsList: Array<cofd_pb.CofdSheet.Skill.AsObject>,
|
|
||||||
socialSkillsList: Array<cofd_pb.CofdSheet.Skill.AsObject>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SkillUpdate extends jspb.Message {
|
|
||||||
getName(): string;
|
|
||||||
setName(value: string): void;
|
|
||||||
|
|
||||||
hasSkill(): boolean;
|
hasSkill(): boolean;
|
||||||
clearSkill(): void;
|
clearSkill(): void;
|
||||||
|
@ -192,18 +109,19 @@ export class SkillUpdate extends jspb.Message {
|
||||||
setSkill(value?: cofd_pb.CofdSheet.Skill): void;
|
setSkill(value?: cofd_pb.CofdSheet.Skill): void;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): SkillUpdate.AsObject;
|
toObject(includeInstance?: boolean): UpdateSkillRequest.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: SkillUpdate): SkillUpdate.AsObject;
|
static toObject(includeInstance: boolean, msg: UpdateSkillRequest): UpdateSkillRequest.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||||
static serializeBinaryToWriter(message: SkillUpdate, writer: jspb.BinaryWriter): void;
|
static serializeBinaryToWriter(message: UpdateSkillRequest, writer: jspb.BinaryWriter): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): SkillUpdate;
|
static deserializeBinary(bytes: Uint8Array): UpdateSkillRequest;
|
||||||
static deserializeBinaryFromReader(message: SkillUpdate, reader: jspb.BinaryReader): SkillUpdate;
|
static deserializeBinaryFromReader(message: UpdateSkillRequest, reader: jspb.BinaryReader): UpdateSkillRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace SkillUpdate {
|
export namespace UpdateSkillRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
name: string,
|
characterUsername: string,
|
||||||
|
characterId: number,
|
||||||
skill?: cofd_pb.CofdSheet.Skill.AsObject,
|
skill?: cofd_pb.CofdSheet.Skill.AsObject,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +158,7 @@ export namespace UpdateSkillValueRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SkillSpecializationsUpdate extends jspb.Message {
|
export class UpdateSkillSpecializationsRequest extends jspb.Message {
|
||||||
getName(): string;
|
getName(): string;
|
||||||
setName(value: string): void;
|
setName(value: string): void;
|
||||||
|
|
||||||
|
@ -250,39 +168,75 @@ export class SkillSpecializationsUpdate extends jspb.Message {
|
||||||
addSpecializations(value: string, index?: number): string;
|
addSpecializations(value: string, index?: number): string;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): SkillSpecializationsUpdate.AsObject;
|
toObject(includeInstance?: boolean): UpdateSkillSpecializationsRequest.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: SkillSpecializationsUpdate): SkillSpecializationsUpdate.AsObject;
|
static toObject(includeInstance: boolean, msg: UpdateSkillSpecializationsRequest): UpdateSkillSpecializationsRequest.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||||
static serializeBinaryToWriter(message: SkillSpecializationsUpdate, writer: jspb.BinaryWriter): void;
|
static serializeBinaryToWriter(message: UpdateSkillSpecializationsRequest, writer: jspb.BinaryWriter): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): SkillSpecializationsUpdate;
|
static deserializeBinary(bytes: Uint8Array): UpdateSkillSpecializationsRequest;
|
||||||
static deserializeBinaryFromReader(message: SkillSpecializationsUpdate, reader: jspb.BinaryReader): SkillSpecializationsUpdate;
|
static deserializeBinaryFromReader(message: UpdateSkillSpecializationsRequest, reader: jspb.BinaryReader): UpdateSkillSpecializationsRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace SkillSpecializationsUpdate {
|
export namespace UpdateSkillSpecializationsRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
name: string,
|
name: string,
|
||||||
specializationsList: Array<string>,
|
specializationsList: Array<string>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Condition extends jspb.Message {
|
export class AddConditionRequest extends jspb.Message {
|
||||||
getName(): string;
|
getCharacterUsername(): string;
|
||||||
setName(value: string): void;
|
setCharacterUsername(value: string): void;
|
||||||
|
|
||||||
|
getCharacterId(): number;
|
||||||
|
setCharacterId(value: number): void;
|
||||||
|
|
||||||
|
getConditionName(): string;
|
||||||
|
setConditionName(value: string): void;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): Condition.AsObject;
|
toObject(includeInstance?: boolean): AddConditionRequest.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: Condition): Condition.AsObject;
|
static toObject(includeInstance: boolean, msg: AddConditionRequest): AddConditionRequest.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||||
static serializeBinaryToWriter(message: Condition, writer: jspb.BinaryWriter): void;
|
static serializeBinaryToWriter(message: AddConditionRequest, writer: jspb.BinaryWriter): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): Condition;
|
static deserializeBinary(bytes: Uint8Array): AddConditionRequest;
|
||||||
static deserializeBinaryFromReader(message: Condition, reader: jspb.BinaryReader): Condition;
|
static deserializeBinaryFromReader(message: AddConditionRequest, reader: jspb.BinaryReader): AddConditionRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace Condition {
|
export namespace AddConditionRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
name: string,
|
characterUsername: string,
|
||||||
|
characterId: number,
|
||||||
|
conditionName: string,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RemoveConditionRequest extends jspb.Message {
|
||||||
|
getCharacterUsername(): string;
|
||||||
|
setCharacterUsername(value: string): void;
|
||||||
|
|
||||||
|
getCharacterId(): number;
|
||||||
|
setCharacterId(value: number): void;
|
||||||
|
|
||||||
|
getConditionName(): string;
|
||||||
|
setConditionName(value: string): void;
|
||||||
|
|
||||||
|
serializeBinary(): Uint8Array;
|
||||||
|
toObject(includeInstance?: boolean): RemoveConditionRequest.AsObject;
|
||||||
|
static toObject(includeInstance: boolean, msg: RemoveConditionRequest): RemoveConditionRequest.AsObject;
|
||||||
|
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
||||||
|
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
||||||
|
static serializeBinaryToWriter(message: RemoveConditionRequest, writer: jspb.BinaryWriter): void;
|
||||||
|
static deserializeBinary(bytes: Uint8Array): RemoveConditionRequest;
|
||||||
|
static deserializeBinaryFromReader(message: RemoveConditionRequest, reader: jspb.BinaryReader): RemoveConditionRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace RemoveConditionRequest {
|
||||||
|
export type AsObject = {
|
||||||
|
characterUsername: string,
|
||||||
|
characterId: number,
|
||||||
|
conditionName: string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,5 @@
|
||||||
import * as jspb from "google-protobuf";
|
import * as jspb from "google-protobuf";
|
||||||
import { CofdSheet } from "../_proto/cofd_pb";
|
import { ApiResult, UpdateAttributeRequest, UpdateSkillValueRequest } from "../_proto/cofd_api_pb";
|
||||||
import { Skills, ApiResult, UpdateAttributeRequest, UpdateSkillValueRequest } from "../_proto/cofd_api_pb";
|
|
||||||
|
|
||||||
const PROTOBUF_CONTENT_TYPE = { 'Content-Type': 'application/x-protobuf' };
|
const PROTOBUF_CONTENT_TYPE = { 'Content-Type': 'application/x-protobuf' };
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,8 @@ mod cofd;
|
||||||
pub(crate) fn routes() -> Vec<rocket::Route> {
|
pub(crate) fn routes() -> Vec<rocket::Route> {
|
||||||
routes![
|
routes![
|
||||||
cofd::update_basic_info,
|
cofd::update_basic_info,
|
||||||
cofd::update_attributes,
|
|
||||||
cofd::update_attribute_value,
|
cofd::update_attribute_value,
|
||||||
cofd::update_skills,
|
cofd::update_skill,
|
||||||
cofd::update_skill_value,
|
cofd::update_skill_value,
|
||||||
cofd::add_condition,
|
cofd::add_condition,
|
||||||
cofd::remove_condition
|
cofd::remove_condition
|
||||||
|
|
|
@ -37,21 +37,8 @@ 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("/cofd/<owner>/<character_id>/basic-info", data = "<info>")]
|
#[post("/rpc/cofd/update_basic_info", data = "<info>")]
|
||||||
pub(super) fn update_basic_info<'a>(
|
pub(super) fn update_basic_info<'a>(info: Proto<UpdateBasicInfoRequest>) -> &'a str {
|
||||||
owner: String,
|
|
||||||
character_id: i32,
|
|
||||||
info: Proto<BasicInfo>,
|
|
||||||
) -> &'a str {
|
|
||||||
"lol"
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/cofd/<owner>/<character_id>/attributes", data = "<info>")]
|
|
||||||
pub(super) fn update_attributes<'a>(
|
|
||||||
owner: String,
|
|
||||||
character_id: i32,
|
|
||||||
info: Proto<Attributes>,
|
|
||||||
) -> &'a str {
|
|
||||||
"lol"
|
"lol"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,22 +79,23 @@ pub(super) async fn update_attribute_value(
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[patch(
|
#[patch("/rpc/cofd/update_skill", data = "<skill_update>")]
|
||||||
"/cofd/<owner>/<character_id>/skills",
|
pub(super) async fn update_skill<'a>(
|
||||||
data = "<skill_update>",
|
skill_update: Proto<UpdateSkillRequest>,
|
||||||
rank = 1
|
|
||||||
)]
|
|
||||||
pub(super) async fn update_skills<'a>(
|
|
||||||
owner: String,
|
|
||||||
character_id: i32,
|
|
||||||
skill_update: Proto<SkillUpdate>,
|
|
||||||
conn: TenebrousDbConn<'_>,
|
conn: TenebrousDbConn<'_>,
|
||||||
logged_in_user: Option<&User>,
|
logged_in_user: Option<&User>,
|
||||||
) -> Result<&'a str, Error> {
|
) -> Result<&'a str, Error> {
|
||||||
let mut character = load_character(&conn, logged_in_user, &owner, character_id).await?;
|
let mut character = load_character(
|
||||||
|
&conn,
|
||||||
|
logged_in_user,
|
||||||
|
&skill_update.character_username,
|
||||||
|
skill_update.character_id,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
let mut sheet: CofdSheet = character.try_deserialize()?;
|
let mut sheet: CofdSheet = character.try_deserialize()?;
|
||||||
let updated_skill: &Skill = skill_update.skill.as_ref().ok_or(Error::InvalidInput)?;
|
let updated_skill: &Skill = skill_update.skill.as_ref().ok_or(Error::InvalidInput)?;
|
||||||
let skill_entry = find_skill_entry(&mut sheet, &skill_update.name);
|
let skill_entry = find_skill_entry(&mut sheet, &updated_skill.name);
|
||||||
|
|
||||||
skill_entry
|
skill_entry
|
||||||
.map(|mut entry| entry.insert(updated_skill.clone()))
|
.map(|mut entry| entry.insert(updated_skill.clone()))
|
||||||
|
@ -115,7 +103,7 @@ pub(super) async fn update_skills<'a>(
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"updated skill {} with {:?}",
|
"updated skill {} with {:?}",
|
||||||
skill_update.name, skill_update.skill
|
updated_skill.name, skill_update.skill
|
||||||
);
|
);
|
||||||
|
|
||||||
character.update_data(&sheet)?;
|
character.update_data(&sheet)?;
|
||||||
|
@ -145,9 +133,7 @@ pub(super) async fn update_skill_value<'a>(
|
||||||
s.dots = request.skill_value;
|
s.dots = request.skill_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
let updated_skill: Skill = skill.map(|s| s.clone()).ok_or(Error::InvalidInput)?;
|
println!("updated skill value");
|
||||||
|
|
||||||
println!("updated skill value",);
|
|
||||||
|
|
||||||
character.update_data(&sheet)?;
|
character.update_data(&sheet)?;
|
||||||
conn.update_character_sheet(&character).await?;
|
conn.update_character_sheet(&character).await?;
|
||||||
|
@ -157,20 +143,12 @@ pub(super) async fn update_skill_value<'a>(
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[put("/cofd/<owner>/<character_id>/conditions", data = "<info>")]
|
#[put("/rpc/cofd/add_condition", data = "<info>")]
|
||||||
pub(super) fn add_condition<'a>(
|
pub(super) fn add_condition<'a>(info: Proto<AddConditionRequest>) -> &'a str {
|
||||||
owner: String,
|
|
||||||
character_id: i32,
|
|
||||||
info: Proto<Condition>,
|
|
||||||
) -> &'a str {
|
|
||||||
"lol"
|
"lol"
|
||||||
}
|
}
|
||||||
|
|
||||||
#[delete("/cofd/<owner>/<character_id>/conditions", data = "<info>")]
|
#[delete("/rpc/cofd/remove_condition", data = "<info>")]
|
||||||
pub(super) fn remove_condition<'a>(
|
pub(super) fn remove_condition<'a>(info: Proto<RemoveConditionRequest>) -> &'a str {
|
||||||
owner: String,
|
|
||||||
character_id: i32,
|
|
||||||
info: Proto<Condition>,
|
|
||||||
) -> &'a str {
|
|
||||||
"lol"
|
"lol"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue