pos login edited with phone number
This commit is contained in:
@@ -439,6 +439,13 @@ type PosUser struct {
|
||||
Pin string `json:"pin,omitempty"`
|
||||
Haspassword bool `json:"has_password"`
|
||||
|
||||
// The shift this person works, resolved for display. Zero / empty when the
|
||||
// account has none, which is every account created before shifts existed.
|
||||
Shiftid int `json:"shift_id,omitempty"`
|
||||
Shiftname string `json:"shift_name,omitempty"`
|
||||
Shiftstart string `json:"shift_start,omitempty"`
|
||||
Shiftend string `json:"shift_end,omitempty"`
|
||||
|
||||
// The password, returned only in the answer to a creation or a reset and
|
||||
// never by a listing. An admin who loses it reissues rather than looks it
|
||||
// up — the right shape even while the column behind it is plaintext.
|
||||
@@ -454,14 +461,28 @@ type PosUser struct {
|
||||
// own outlet, and no field in this struct can say otherwise — which is the same
|
||||
// inversion that stopped a till naming its own shop.
|
||||
type PosUserRequest struct {
|
||||
Userid int `json:"user_id"`
|
||||
Fullname string `json:"full_name"`
|
||||
Role string `json:"role"`
|
||||
Pin string `json:"pin"`
|
||||
Password string `json:"password"`
|
||||
Authname string `json:"authname"`
|
||||
Userid int `json:"user_id"`
|
||||
Fullname string `json:"full_name"`
|
||||
Role string `json:"role"`
|
||||
Pin string `json:"pin"`
|
||||
Password string `json:"password"`
|
||||
Authname string `json:"authname"`
|
||||
|
||||
// The mobile number this person signs in with.
|
||||
//
|
||||
// Normalised to ten digits before it is stored, because the till matches on
|
||||
// it exactly and "+91 98765 43210" typed back as "9876543210" would not
|
||||
// find the row. Unique among a tenant's till accounts.
|
||||
Contactno string `json:"contactno"`
|
||||
Status string `json:"status"`
|
||||
|
||||
// Which shift this person works — a staffshifts.staffshiftid, stored on
|
||||
// app_users.shiftid. Zero leaves it unset.
|
||||
//
|
||||
// Informational. Nothing refuses a bill rung outside it; the terminal shows
|
||||
// it so a counter knows who is due.
|
||||
Shiftid int `json:"shift_id"`
|
||||
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// PosUserWebRequest is a staff change made from the web console.
|
||||
|
||||
53
models/posshift.go
Normal file
53
models/posshift.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// StaffShifts is a working window at one outlet.
|
||||
//
|
||||
// Separate from `ridershifts`, which already exists and was the obvious thing
|
||||
// to reuse — but is the wrong shape twice over. It carries delivery economics
|
||||
// (`basefare`, `fuelcharge`, `additionalkm`, `firstmilecharge`) that mean
|
||||
// nothing at a counter, and it is scoped by `applocationid`, a city, where a
|
||||
// shop's hours belong to the shop. A supermarket in Selvapuram and one in
|
||||
// Gandhipuram do not open at the same time because they share a city.
|
||||
//
|
||||
// A person is assigned exactly one of these via `app_users.shiftid`, which is
|
||||
// the column that already existed. That makes a shift a *template* — "the
|
||||
// morning shift" — rather than a roster of dated assignments. A roster is the
|
||||
// richer model and the one to reach for if per-date planning is ever wanted;
|
||||
// this is the smaller thing that answers "who is on the early shift" without a
|
||||
// second table and a second screen.
|
||||
//
|
||||
// Informational. Nothing refuses a bill rung outside a shift: the terminal has
|
||||
// never been run against this, and a cashier locked out mid-queue by a clock is
|
||||
// a worse failure than a bill filed against the wrong window.
|
||||
type StaffShifts struct {
|
||||
Staffshiftid int `json:"staff_shift_id" gorm:"primaryKey;autoIncrement;column:staffshiftid"`
|
||||
|
||||
Tenantid int `json:"tenantid" gorm:"column:tenantid;index"`
|
||||
Locationid int `json:"locationid" gorm:"column:locationid;index"`
|
||||
|
||||
// What a person calls it — "Morning", "Evening", "Weekend cover".
|
||||
Name string `json:"name" gorm:"column:name"`
|
||||
|
||||
// Stored as text in 24-hour `HH:MM`, matching how `ridershifts` already
|
||||
// holds its own times. Not a `time` column: these are wall-clock windows
|
||||
// that repeat, not instants, and a date component on them invites exactly
|
||||
// the timezone confusion that put a day of POS bills under the wrong
|
||||
// business date.
|
||||
Starttime string `json:"start_time" gorm:"column:starttime"`
|
||||
Endtime string `json:"end_time" gorm:"column:endtime"`
|
||||
|
||||
// Which days it runs, as a 7-character mask starting Monday — "1111100"
|
||||
// is Monday to Friday. Empty means every day, so a shop that never varies
|
||||
// its week does not have to say so.
|
||||
Weekdays string `json:"weekdays" gorm:"column:weekdays"`
|
||||
|
||||
Status string `json:"status" gorm:"column:status"`
|
||||
Created time.Time `json:"created" gorm:"column:created;autoCreateTime"`
|
||||
Updated time.Time `json:"updated" gorm:"column:updated;autoUpdateTime"`
|
||||
}
|
||||
|
||||
func (StaffShifts) TableName() string {
|
||||
return "staffshifts"
|
||||
}
|
||||
Reference in New Issue
Block a user