issuperadmin on app_users (schema change already applied to the DB) is now returned by AppLogin/TenantWebLogin's login response, gated server-side rather than via a client-supplied roleid. Fixes the login enrichment query (GetTenantUserById) to LEFT JOIN app_location instead of INNER JOIN — a tenantless super-admin row was previously silently dropped, so the login "succeeded" but returned an empty struct. Also exposes createtenantuser on the web route group (was mob-only). No repository changes were needed for location auto-provisioning: GORM was already inserting the nested tenantlocations association on tenant creation, it just wasn't reachable from the web. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
105 lines
3.9 KiB
Go
105 lines
3.9 KiB
Go
package models
|
|
|
|
type UserInfo struct {
|
|
Userid int `json:"userid"`
|
|
Authname string `json:"authname"`
|
|
Configid int `json:"configid"`
|
|
Authmode int `json:"authmode"`
|
|
Roleid int `json:"roleid"`
|
|
Firstname string `json:"firstname"`
|
|
Lastname string `json:"lastname"`
|
|
Fullname string `json:"fullname"`
|
|
Password string `json:"password"`
|
|
Email string `json:"email"`
|
|
Contactno string `json:"contactno"`
|
|
Address string `json:"address"`
|
|
Suburb string `json:"suburb"`
|
|
City string `json:"city"`
|
|
State string `json:"state"`
|
|
Postcode string `json:"postcode"`
|
|
Userfcmtoken string `json:"userfcmtoken"`
|
|
Shiftid int `json:"shiftid"`
|
|
Shiftname string `json:"shiftname"`
|
|
Pin int `json:"pin"`
|
|
Partnerid int `json:"partnerid"`
|
|
Tenantid int `json:"tenantid"`
|
|
Locationid int `json:"locationid"`
|
|
Applocationid int `json:"applocationid"`
|
|
Applocation string `json:"applocation"`
|
|
Applatitude string `json:"applatitude"`
|
|
Applongitude string `json:"applongitude"`
|
|
Appradius int `json:"appradius"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type User struct {
|
|
Userid int `json:"userid" gorm:"Primary_Key"`
|
|
Authname string `json:"authname"`
|
|
Firstname string `json:"firstname"`
|
|
Lastname string `json:"lastname"`
|
|
Password string `json:"password"`
|
|
Email string `json:"email"`
|
|
Dialcode string `json:"dialcode"`
|
|
Contactno string `json:"contactno"`
|
|
Configid int `json:"configid"`
|
|
Authmode int `json:"authmode"`
|
|
Roleid int `json:"roleid"`
|
|
Pin int `json:"pin"`
|
|
Deviceid string `json:"deviceid"`
|
|
Devicetype string `json:"devicetype"`
|
|
Userfcmtoken string `json:"userfcmtoken"`
|
|
Address string `json:"address"`
|
|
Suburb string `json:"suburb"`
|
|
City string `json:"city"`
|
|
State string `json:"state"`
|
|
Postcode string `json:"postcode"`
|
|
Partnerid int `json:"partnerid"`
|
|
Tenantid int `json:"tenantid"`
|
|
Locationid int `json:"locationid"`
|
|
Applocationid int `json:"applocationid"`
|
|
Status string `json:"status"`
|
|
Shiftid int `json:"shiftid"`
|
|
Issuperadmin bool `json:"issuperadmin"`
|
|
}
|
|
|
|
type TenantUserInfo struct {
|
|
Userid int `json:"userid"`
|
|
Authname string `json:"authname"`
|
|
Configid int `json:"configid"`
|
|
Authmode int `json:"authmode"`
|
|
Roleid int `json:"roleid"`
|
|
Firstname string `json:"firstname"`
|
|
Lastname string `json:"lastname"`
|
|
Fullname string `json:"fullname"`
|
|
Password string `json:"password"`
|
|
Email string `json:"email"`
|
|
Contactno string `json:"contactno"`
|
|
Address string `json:"address"`
|
|
Suburb string `json:"suburb"`
|
|
City string `json:"city"`
|
|
State string `json:"state"`
|
|
Postcode string `json:"postcode"`
|
|
Userfcmtoken string `json:"userfcmtoken"`
|
|
Pin int `json:"pin"`
|
|
Partnerid int `json:"partnerid"`
|
|
Locationid int `json:"locationid"`
|
|
Applocationid int `json:"applocationid"`
|
|
Tenantid int `json:"tenantid"`
|
|
Tenantname string `json:"tenantname"`
|
|
Tenantaddress string `json:"tenantaddress"`
|
|
Tenantcity string `json:"tenantcity"`
|
|
Tenantpostcode string `json:"tenantpostcode"`
|
|
Tenantlat string `json:"tenantlat"`
|
|
Tenantlong string `json:"tenantlong"`
|
|
Locationname string `json:"locationname"`
|
|
Applocation string `json:"applocation"`
|
|
Applatitude string `json:"applatitude"`
|
|
Applongitude string `json:"applongitude"`
|
|
Appradius int `json:"appradius"`
|
|
Moduleid int `json:"moduleid"`
|
|
Categoryid int `json:"categoryid"`
|
|
Categoryname string `json:"categoryname"`
|
|
Subcategoryid int `json:"subcategoryid"`
|
|
Issuperadmin bool `json:"issuperadmin"`
|
|
}
|