Skip to content

Commit

Permalink
refactor(modules): moved user interface into shared modules directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Carr committed May 21, 2020
1 parent b5d90f9 commit d403676
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 246 deletions.
2 changes: 1 addition & 1 deletion src/modules/auth/email.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Module from "..";
import FunctionResponse from "../../functions/response";
import Warning from "../shared/warning";
import { Warning } from "../shared";

export interface SignUpSettingsResponse extends FunctionResponse {
/**
Expand Down
246 changes: 1 addition & 245 deletions src/modules/core/user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Module from "..";
import FunctionResponse from "../../functions/response";
import Warning from "../shared/warning";
import { Warning, User } from "../shared";

interface SearchCriteria {
/**
Expand All @@ -16,250 +16,6 @@ interface SearchCriteria {
value: string | number;
}

interface CustomField {
/**
* The type of field (such as text field
* or checkbox).
*/
type: string;

/**
* The field's value.
*/
value: string;

/**
* The field's name.
*/
name: string;

/**
* The field's shortname.
*/
shortname: string;
}

interface Preference {
/**
* The preference's name.
*/
name: string;

/**
* The preference's value.
*/
value: string;
}

export interface User {
/**
* The unique identifier of the user.
*/
id: number;

/**
* The user's Moodle username.
*/
username?: string;

/**
* The user's first name.
*/
firstname?: string;

/**
* The user's last name.
*/
lastname?: string;

/**
* The user's full name.
*/
fullname: string;

/**
* The user's email address.
*/
email?: string;

/**
* The user's postal address.
*/
address?: string;

/**
* The user's first phone number.
*/
phone1?: string;

/**
* The user's second phone number.
*/
phone2?: string;

/**
* The user's ICQ number.
*/
icq?: string;

/**
* The user's Skype username.
*/
skype?: string;

/**
* The user's Yahoo username.
*/
yahoo?: string;

/**
* The user's AIM screen name.
*/
aim?: string;

/**
* The user's MSN username.
*/
msn?: string;

/**
* The user's organizational department.
*/
department?: string;

/**
* The user's instituion.
*/
institution?: string;

/**
* An arbitrary ID number for the user (sometimes
* from their institution).
*/
idnumber?: string;

/**
* The user's interests, separated by commas.
*/
interests?: string;

/**
* The UNIX timestamp of the first time the user
* accessed the Moodle site. This value is 0 if
* the user has never accessed the site.
*/
firstaccess?: number;

/**
* The UNIX timestamp of the last time the user
* accessed the Moodle site. This value is 0 if
* the user has never accessed the site.
*/
lastaccess?: number;

/**
* The authentication plugin this user uses,
* such as `manual` or `ldap`.
*/
auth?: string;

/**
* Whether the user's Moodle account is
* suspended (true) or not (false). A suspended
* user is prevented from signing in to Moodle.
*/
suspended?: boolean;

/**
* Whether the user's Moodle account is
* confirmed (true) or not (false).
*/
confirmed?: boolean;

/**
* The user's user-specific language, such as
* `en` or `en_ar` (pirate language).
*/
lang?: string;

/**
* The user's user-specific calendar type,
* such as `gregorian`.
*/
calendartype?: string;

/**
* The name of the user's user-specific
* Moodle theme.
*/
theme?: string;

/**
* The user's user-specific timezone. A
* value of `"99"` denotes the site default.
*/
timezone?: string;

/**
* The user's mail format code. A value of 0
* denotes plain text, and 1 denotes HTML.
*/
mailformat?: number;

/**
* The user's profile description.
*/
description?: string;

/**
* The user's profile description format code.
*
* `0` - Moodle
* `1` - HTML
* `2` - plain text
* `4` - Markdown
*/
descriptionformat?: string;

/**
* The user's home city.
*/
city?: string;

/**
* The user's URL.
*/
url?: string;

/**
* The user's home country (provided as a
* country code, such as `GB` or `AU`).
*/
country?: string;

/**
* The URL of the user's Moodle profile
* image (small size).
*/
profileimageurlsmall: string;

/**
* The URL of the user's Moodle profile
* image.
*/
profileimageurl: string;

/**
* The user's custom profile fields.
*/
customfields?: CustomField[];

/**
* The user's preferences.
*/
preferences?: Preference[];
}

export interface GetUsersResponse extends FunctionResponse {
/**
* The array of users that match the provided search
Expand Down
2 changes: 2 additions & 0 deletions src/modules/shared/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as User } from "./user";
export { default as Warning } from "./warning";
Loading

0 comments on commit d403676

Please sign in to comment.