added SettingsData type

This commit is contained in:
Jonathan Barrow 2023-10-02 16:46:55 -04:00
parent ff104b496f
commit 32c662db41
No known key found for this signature in database
GPG Key ID: E86E9FE9049C741F
3 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import { Schema, model } from 'mongoose';
import { SettingsData } from '@/types/miiverse/settings';
import { HydratedSettingsDocument, ISettings, ISettingsMethods, SettingsModel } from '@/types/mongoose/settings';
const SettingsSchema = new Schema<ISettings, SettingsModel, ISettingsMethods>({
@ -48,7 +49,7 @@ const SettingsSchema = new Schema<ISettings, SettingsModel, ISettingsMethods>({
}
});
SettingsSchema.method<HydratedSettingsDocument>('json', function json(): Record<string, any> {
SettingsSchema.method<HydratedSettingsDocument>('json', function json(): SettingsData {
return {
pid: this.pid,
screen_name: this.screen_name

View File

@ -0,0 +1,4 @@
export type SettingsData = {
pid: number;
screen_name: string;
};

View File

@ -1,4 +1,5 @@
import { Model, HydratedDocument } from 'mongoose';
import { SettingsData } from '@/types/miiverse/settings';
export interface ISettings {
pid: number;
@ -18,7 +19,7 @@ export interface ISettings {
}
export interface ISettingsMethods {
json(): Record<string, any>;
json(): SettingsData;
}
interface ISettingsQueryHelpers {}